Show links and post info on single.php only (2 posts)

  1. soulcreeper
    Posted 9 years ago #

    ok, so this is the situation. i've got a sidebar that shows searchbar, "Currently vieweing", Pages, and two other blocks that i made myself. on the single.php page i only got the previous-next links added at the top of the sidebar, because i only want them to be shown on the single post page.

    now comes the tricky part. i want to add the previous-next links in the sidebar so next time i can edit the looks very easily just by opening up the sidebar.php. but then it would also be shown on the index.php as empty links, since it doesnt know on what post it is because on the index.php there are 3 posts shown.

    so how can i make the previous-next links and the "Currently viewing" part only to be shown when it's on single.php page?

    roughly something like this:
    if (location) = single.php
    then show "Currently viewing" and previous-next links.

    or the other way:
    if (location) = index.php
    then hide "Currently viewing" and previous-next links.

    can anybody help me out here? thank so much

  2. moshu
    Posted 9 years ago #

    There are two (2) kind of next/prev links - I hope you are aware of that!
    1. The one used on the index or archive or category-templates; for displaying "paged" views, i.e. you have 107 posts and you show only 10 on your main/home page, then you need this to be able to go through the rest of 11 "pages"

    2. For back and forth navigation on single post view
    These have to be in the Loop.

Topic Closed

This topic has been closed to new replies.

About this Topic