• ubersoft

    (@ubersoft)


    I currently have WordPress 2.02 set up at Ubersoft.net to be the publishing platform for my webcomic. It’s been up for a little under a week, and all in all it is working very well. However, I have noticed a little problem when it comes to site navigation that I hope some of you folks can help me work around.

    At the top and bottom of the main index page I use the following navigation code, which was taken with very little modification from the Kubrick theme:


    <div class="navigation">
    <div class="alignleft"><?php posts_nav_link('','','<img name="previous_day" alt="Previous Day" src="http://ubersoft.net/images/previous_day.png">') ?></div>
    <div class="alignright"><?php posts_nav_link('','<img name="next_day" alt="Next Day" src="http://ubersoft.net/images/next_day.png">','') ?></div>
    </div>

    The biggest difference is the use of images, I guess. Anyway, the overall effect is that from the front page you can browse forward and back through the comics with a minimum of fuss…

    … until you get to the very “earliest” index page — currently the page for March 13, also known as “ubersoft.net/page/11”. At that point, there is still a “previous” link, and if you click on it, it tries to load “ubersoft.net/page/12,” which doesn’t exist, so you get a 404 instead.

    Is there any way to make the “previous day” posts_nav_link disappear when there are no more previous pages to read?

    I have tried putting the posts_nav_linkl in the loop, but that doesn’t help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter ubersoft

    (@ubersoft)

    I’m still trying to figure this out and haven’t had any luck. Is it a problem with using permalinks?

    Chris_K

    (@handysolo)

    I don’t have the answer, but the “why” of it is that those links get put on every page — there’s no conditional checking to see if there actually is a previous or next page.

    Maybe a little conditional logic with Conditional_Tags mixed in there would help?

    Thread Starter ubersoft

    (@ubersoft)

    Oh man, how did I miss this feature???

    I think I’m going to have dedicate my site to you, Handy. Thanks. 🙂

    Thread Starter ubersoft

    (@ubersoft)

    OK, so from what I’ve been able to figure out, to use a conditional tag, you declare the condition, and then nested in that condition is whatever you ant to happen if the condition is true.

    the problem is, these tags seem limited to looking at the page you are on (actual data) rather than pages you *could* access (potential data). What I need to do is set up the following:

    – WordPress checks whether or not there are any more articles in the specific archive than are being displayed on the page.

    – if there are (if it is “true”) then posts_nav_link or whatever appropriate tag is used

    – if not, it is empty

    This should be along the lines of


    if (is_tagihaventfiguredoutyet())
    {
    posts_nav_link ('','previous','');
    }

    if (is_othertagihaventfiguredoutyet())
    {
    posts_nav_link ('','','next');
    }

    So all I need to do is figure out what tagihaventfiguredoutyet and othertagihaventfiguredoutyet are :)

    Assuming they exist. They might not exist.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘wp 2.02, posts_nav_link, and 404 errors’ is closed to new replies.