Where is single post page template?
-

KHParticipant
Hello, Could you please tell me where the single post page template is? Is it this one “content.php” in the theme folder? I’ve add a shortcode into this template but it appears in category page as well. How can I customize something only in single post page without affecting achieve page?
Thanks
Hello,
These templates are very similar in our theme so we used one file for both. You can display your code on the single post page using the following conditional function https://developer.wordpress.org/reference/functions/is_single/
Regards

KHParticipant
Could you please give me the code? For example, if I want to add only this shortcode <?php echo do_shortcode('[html_block id="8810"]');?> only for the single post page, what the code would be?
You just need to wrap it with if statement like this
if ( is_single() ) {
// YOUR CODE GOES HERE
}

KHParticipant
Work fine, thank you!
<?php if ( is_single() ) {
echo do_shortcode('[html_block id="26"]');
} ?>
The topic ‘Where is single post page template?’ is closed to new replies.