not able to add subscribe to newsletter shortcode at end of blog page. want to add after pagination and before footer. anybody know how to add? the page i am working on Website
1 Answer
I would suggest using do_shortcode
as mozboz suggested.
But I think that using the single.php file is a better way of doing it.
The template you should use will depend on how your theme is structured, but if the element is supposed to always display after a post then editing the main template is the best way to do it.
-
After adding the
<?php echo do_shortcode('[name_of_shortcode]'); ?>
code intosingle-blog.php
getting error Website Experiencing technical difficulties– ShubhamKCommented Jul 21, 2020 at 11:35 -
Would you be able to specify if use kept the square brackets around
('[name_of_shortcode]')
or if you just used('name_of_shortcode')
in your final code? Commented Jul 28, 2020 at 12:16 -
Getting a WordPress PHP error could also be caused by other factors. I would suggest checking the
error.log
file to see what the actual issue might be. Unfortunetely WP doesn't like to be specific about its error codes. Commented Jul 28, 2020 at 12:19
do_shortcode
? it lets you run a shortcode from PHP. You could add it at the end of your main index.php.