Search code examples
phpwordpress

How to publish SHORTCODe with php manually?


WordPress has the option to use a plugin and publish something by writing SHORTCODE in a post or page, and then the plugin will publish something. How can I add random numbers to PHP and make them published via PHP and not via the page/post section? For example, if I add this shortcode to a page/post it will publish something. [ivory-search id="1146" title="AJAX Search Form"]

But how do I add in php so that I do not add this manually on every page? This code publishes pages and I tried to add the above shortcode under the <div class="entry-content"> but it did not work Tried to add this also but did not work too:

echo do_shortcode('[ivory-search id="1146" title="AJAX Search Form"]');

Somehow I cannot put PHP code with shortcode here, so here are code snippets : https://codefile.io/f/v4RyXKKedT

and this is photo of my code: Photo of code


Solution

  • please echo shortcode like

    <?php echo do_shortcode('[ivory-search id="1146" title="AJAX Search Form"]'); ?>