views:

88

answers:

1

Hi,

I am trying to figure out I can only execute my plugin on the single post page rather than the main index page. It is ignoring the tag which I thought would resolve this issue.

Currently, this is how it is working:

add_action('the_content', 'my_plugin');

I tried detecting the but it would return false all time. I thought it would be removed on the single post pages:

if (strpos($post_content, '<!--more-->')) {  
            return false;
    }

There is probably a better hook for this but I am definitely a newbie.

+1  A: 

Do this right after the_post();

Global $more;

or right before you call the_content;

By the way, the best way to make sure that something is not ran on the homepage is by check if it is the home page. Try this:


if(!is_home())
{
 // Run Plugin
}

Chacha102
Thanks Chacha! Checking for:`is_home()`did the trick =)
Knix
Check this page for other conditional tags: http://codex.wordpress.org/Conditional_Tags
Chacha102