Support » Fixing WordPress » How to know I am inside the “detail” of a post ?

  • Resolved yannick1234


    Hi there,

    I’d like to display slightly different content when I am in the “detailed” section of a post, versus what I have in the “list” mode.

    Let me explain, as I’m sure I am not using the right words:

    * what I call “detailed” section of a post is what can be found after the <!--more--> tag.
    * what I call “list mode” is when you see the listing of several posts, and only what is before the <!--more--> tag is displayed.

    I managed to do it by doing something very ugly (I created 2 different global variables…) but I’m sure there is an already easy existing way to do it 🙂


Viewing 1 replies (of 1 total)
  • In WP lingo:
    detailed = single post view; usually displayed by the single.php template tag.
    list mode – multiple posts view; can be index, monthly or category archive etc.

    For different views WP uses different template files, see Template_Hierarchy. Including certain code/content in those template files (if they exist in your theme) will display it only when they are in use.
    Furthermore, there are Conditional_Tags that you can use.

    The Codex is a gold mine of documents…

Viewing 1 replies (of 1 total)
  • The topic ‘How to know I am inside the “detail” of a post ?’ is closed to new replies.