×
Black Friday Savings
00Days
:
04Hours
:
57Minutes
:
32Seconds
Use Coupon 40%OFF

Includes 1 Year Priority Support

Shop Now

WP SITES

3093 Coded Tutorials & 296 Plugins

Add Text Content After Single Posts In Any Theme

This PHP code enables you to conditionally display any type of content after single posts.

It includes a conditional tag which can be changed.

You’ll also notice the .= ( dot and equals sign )

These are called PHP string operators which basically add your custom content to the default content using a filter before printing it to the page.

StudioPress Theme Users

If your theme includes hooks, you can still use the code above or your theme specific hooks:

Here’s a basic example of what the code looks like for StudioPress users:

function wpsites_after_content() {
	
if( is_singular('post') ) {
		
echo'<div class="after-post">Add Content</div>';
       }
}
add_action('genesis_entry_footer', 'wpsites_after_content', 5 );

NO need to filter the content. Simply hook it in using your themes hooks.

Related Solutions

Was this helpful?

Yes
No
Thanks for your feedback!

Leave a Reply