Support » Plugins and Hacks » Only print on post page

Only print on post page

  • Hello guys.

    I’m willing to develop a plugin but I can’t find a way to do what I need.

    The plugin will have a shortcode added to a post. I need to find a way to, inside of the plugin code, verify where the post is being shown: if it’s on the home page, a category page, an archive page… or the post/page page (single.php or page.php).

    If it’s not on the post page (any page where more-link will be present if it is used on the post), the plugin will print nothing. Only if it’s on the post/page page (the whole text is present and we have the #more-xxx flag) the plugin will print its content.

    If the shortcode is used after more-link it’s easy, but if it appear before more-link it will print its content everywhere, and that’s not what I want.

    Any idea on how to implement that?

  • The topic ‘Only print on post page’ is closed to new replies.