Help adding shortcode to single post template

Hello !
Is there a way to add a shortcod at the end of my single page template ?

I’d like to display a grid of the most recent post at the end of my posts.

Thanks a lot for the help !

Hello @eri-se,

Thanks for writing in!

To make the necessary changes you will have to make changes in template file. Along with that some custom development work is required which falls outside the scope of support we can offer. Having said that I can point you in right direction that will help you to get started.

  • Before proceeding, please install and setup child theme using following resources.

Download Child theme from following source: https://theme.co/apex/child-themes

Please take a look at following article to setup child theme:

  • Copy content.php from /wp-content/themes/x/framework/views/integrity/ to /wp-content/themes/x-child/framework/views/integrity/. If you are using stack other then Integrity, please make the necessary changes. You will have to create child folders.

  • After that add following code to output the content of shortcode in content.php file.

<?php echo do_shortcode("[recent_posts count=2]"); ?>

You can add the above code after line number 17 as shown in following screenshot.

For the list of shortcodes, please take a look at following page:

http://demo.theme.co/integrity-1/shortcodes/recent-posts/

Thanks.

Awesome it worked !

I juste used The Grid instead of recent_post

using [the_grid name=‘Recent Post_Grid’] instead of [the_grid name=“Recent Post_Grid”].
Thanks a lot :slight_smile:

Hey @eri-se,

You may use any shortcode to replace the one in the suggestion. Glad to hear it’s sorted.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.