I'm writing a plugin that adds some custom content near the end of a post (or page). So I've added a filter for 'the_content', and the plugin adds its content there. Mostly, it works.
However, some sites show the entire content of several posts on the homepage (rather than just excerpts). On those sites, my filter is being called once for every post that is displayed. So the custom content shows up more than once.
Is there some way for me to detect when my filter is a nested call? I.e. that it is being called for the content of a post which is being displayed on the homepage. I could then add my custom content only when it is a "top level" call.
I also considered attaching my filter to the footer instead of the content, but I've run across themes that don't have a footer.
Thanks! Ken