I am looking to write a plugin that executes code on individual post pages but does not try to execute that code in search results or archives or anything that shows multiple posts in one place. I tried using a filter on "the_content", but that seems to execute everywhere. Seems this would be a simple thing to find out, but the dual meaning of the word "filter" has made searching for this pretty difficult.
As a related question, is there a good source for seeing what filters and actions are fired for different types of pages in a theme? I'm sure I'll have a similar problem in the future, and learning to fish will be helpful here.
Many thanks.
And maybe this code will be a good guide for you
function yourprefix_add_to_content( $content ) {
if( is_single() ) {
$content .= 'Your new content here';
}
return $content;
}
add_filter( 'the_content', 'yourprefix_add_to_content' );