WordPress.org

Ready to get started?Download WordPress

Forums

Hook into single post display? (2 posts)

  1. marke1
    Member
    Posted 8 years ago #

    Anybody know how to determine when a single post is being displayed, as opposed to the home page where multiple pages are displayed?

    I want to add a filter for special processing when viewing a single post. My site uses mod_rewrite so I can't check $_GET for the existance vars, which would seem to be an easy way to determine if a single post is being viewed.

    As an example, when a single post is displayed, if the user is an "Author" role then I want to show a particular message. I can hook into the_content with the add_filter function, but I don't see a way to hook into showing a single post.

  2. Kafkaesqui

    Posted 8 years ago #

    Test on is_single() or $wp_query->is_single.

    http://codex.wordpress.org/Conditional_Tags

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.