WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to know I am inside the "detail" of a post ? (2 posts)

  1. yannick1234
    Member
    Posted 6 years ago #

    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 :-)

    Regards,
    Yannick

  2. moshu
    Member
    Posted 6 years ago #

    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...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags