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

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.