Forums

Conditional content in sidebar.php based on the_id() (3 posts)

  1. arretx
    Member
    Posted 1 year ago #

    My blogroll is a stack of links in the form of images on the right-hand sidebar in a 3-column template (www.executiveapprentice.com.) What I would like to do is use a conditional statement that will prevent this instance of the page links showing up unless the_id() of the post on the index.php is a specific number.

    As I'm posting this, I think I just solved my own problem in my head. Where I was thinking, "if the index is being displayed, don't show this set of page links, but if the_id() is "X" do show it" I am now thinking that maybe I should do it the other way around.

    If the_id() is "X" then show them, otherwise do nothing. From what I can see, the_id() if placed outside of the loop is either the most recent post, or the current page. Is this correct?

  2. epicalex
    Member
    Posted 1 year ago #

    You want to be looking to use is_page() or is_single(), with the page/post id in the brackets.

  3. arretx
    Member
    Posted 1 year ago #

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic