• Hi,

    I’m running my webcomic on WP 2.0 with Tyler Martin’s ComicPress theme and I’d like to figure out how to modify the navigation in the following ways:

    1. The index.php page currently has page-to-page navigation links, called by the next_posts_link() and previous_posts_link() functions. Since each page will only ever have one entry per page (namely, that day’s comic), I’d like to dispense with the page-to-page navigation links and use post-to-post links. Post-to-post links show up on single.php via the previous_post_link() and next_post_link() functions, but when I try plugging those functions in the index.php page, I get no links. Is there a way to make this happen?

    2. Similarly, I’d like to modify the calendar links to take me directly to that day’s comic (as opposed to an archive page of “all” posts for that day since, again, there will only be one post per day). Right now I’m using a javascript redirect on archive.php, but I’d like to do something that doesn’t depend on javascript to work.

    Any suggestions with either of these would be much appreciated. The site is at https://www.braincud.com/ in case you need it.

    Thanks,

    Matt Jordan

Viewing 4 replies - 1 through 4 (of 4 total)
  • Option for your 1:

    Insert this before your use of previous_post_link() / next_post_link() in your index.php:

    <?php global $wp_query; $wp_query->is_single = true; ?>

    For symmetry (and to avoid possible conflicts with elements on the page that expect is_single to be false on the home page), slip this in when you’re done:

    <?php $wp_query->is_single = false; ?>

    Thread Starter muhkayoh

    (@muhkayoh)

    Thanks! That works perfectly!

    Matt

    Brilliant solution! I’ve been looking for the way to do this all day. I was really close to getting it myself (I was doing $this->is_single = true; Obviously my grasp of OO fails it.).

    Thanks for your help.

    tim534

    (@tim534)

    I’m aiming for a similar one-post-visible-at-a-time look. The above is_single works great, except…

    Any way to do this so that the previous_post_link goes to not a single post entry with visible comments, but to a previous set of entries (in my case, one) as would be done with the default navigation code (posts_nav_link)? I don’t want the comments to show when someone is navigating back through the previous entries. Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Navigation hacks?’ is closed to new replies.