How to filter posts, pages, archives and others page?

I am developing a new plugin. In this plugin user can choose where the plugin will display.

If user choose only in post or archives pages then how can i find it?
if I use add_filter('the_content','function');

Read More

then my plugin will show all pages but how to do that in single category or archive page?

Related posts

Leave a Reply

2 comments

  1. You can check if a specific page is being displayer with these conditonals

    is_page()   //For pages
    is_single   //for posts
    is_singular //for posts AND pages
    is_category //for categories
    is_tag()    //for tags
    is_404()    //for 404 page
    

    Also, don’t use anonymous functions when you add filters. always use defined functions

    add_filter ('the_content','my_magic_function');
    

    For a more complete list of template tags check visit:
    http://codex.wordpress.org/Function_Reference/is_page