I have the following code running in a plugin:
add_filter('the_content','thousand_pay');
//Callback function
function thousand_pay($content)
{
echo $content;
if( !in_category( 'Stories') )
{
return;
}
?>
<hr></hr>
[Some HTML]
<?php
return
}
For some reason, on individual posts' pages the HTML gets printed multiple times:
Can anyone think of why this would be? I read here that I might have to add to the conditional to check is_singular() and is_main_query(), so it would look like if(!in_category('Stories') || !is_singular() || !is_main_query()
, but that just seems to stop the HTML getting printed at all on a post page. Any ideas?