Forums | Breakage in comic navigation, any ideas?

You must be logged in to post Login Register

Search Forums:


 






Breakage in comic navigation, any ideas?

UserPost

3:17 pm
March 31, 2009


heinous

New Member

posts 2

Hi, I've been using the stripshow plugin for a while now, and I have a kind of strange problem that is probably related to something I've messed up in the theme code, or am not quite getting.  It goes like this:

So the problem is that when navigating through comics using the arrow navigation, sometimes, going forward or back (and it's different for both cases) instead of getting sent to the next or previous comic, the arrow links to a blog post that is not a comic.  It mostly works, just in a few places it breaks.  To view an example, you could go to:

http://wolverog.com/?p=1137

Clicking the forward arrow takes you to a blog post (http://wolverog.com/?p=1139), instead of the next comic, which should be:

http://wolverog.com/?p=1140

In this example, going back from http://wolverog.com/?p=1140 works fine, it's just going forward that is broken.  Actually, going forward again to the next comic takes to another blog post again ( http://wolverog.com/?p=1143 ) but it should go to ( http://wolverog.com/?p=1195 ).  Here again, going back from http://wolverog.com/?p=1195 works fine.

A similar example, where we see the link breaking going backwards but not forward would be if you go to:

http://wolverog.com/?p=1098

If you try to go back to the previous comic, it goes to another blog post ( http://wolverog.com/?p=1094 ) when it should be going to http://wolverog.com/?p=1085http://wolverog.com/?p=1085 links forward to http://wolverog.com/?p=1098 fine, however.

So anyway, I only see this kind of breakage in a few places, and am trying to figure out what is causing it to happen.  It's just annoying that you can't click through all the comics from beginning to end in forward or reverse order, without loosing the navigation somewhere in the middle.

I thought that maybe it might have something to do with the php calls that I use for the arrow navigation in my theme.  Here's what I've got for example in my single.php:


    <?php
    if(is_home()) {
    $we_are_home = TRUE; // for some reason, is_home() doesn't work after this.
    query_posts('cat='.get_option('stripshow_category').'&showposts=1');
    global $wp_query;
    $wp_query->is_single = true;
    $wp_query->is_home = true;
    $wp_query->is_category = false;
    the_post();
    }
    ?>

      <?php if (!in_category(get_option('stripshow_category')) || !is_single()) { // show this for non-comics ?>
      <?php } else { // show this for comics ?>
            <table border="0" cellspacing="0" cellpadding="0" id="sidebarNavArrows">
                <tr>
                    <td><span class="arrow"><span class="first_day">
                    <?php first_comic('<img src="'.get_bloginfo('stylesheet_directory').'/images/first_day.gif" alt="Fir
st Comic" />','yes') ?></span></span></td>
                    <td><span class="arrow"><span class="previous_day">
                    <?php previous_post_link('%link','<img src="'.get_bloginfo('stylesheet_directory').'/images/previous
_day.gif" alt="Previous Comic" />','yes') ?></span></span></td>
                    <td><span class="arrow"><span class="next_day">
                    <?php next_post_link('%link','<img src="'.get_bloginfo('stylesheet_directory').'/images/next_day.gif
" alt="Next Comic" />','yes') ?></span></span></td>
                    <td><span class="arrow"><span class="last_day">
                    <?php last_comic('<img src="'.get_bloginfo('stylesheet_directory').'/images/last_day.gif" alt="Last
Comic" />','yes') ?></span></span></td
                </tr>
            </table>
      <?php } ?>

So you can see that I'm using next_post_link() and previous_post_link() instead of next_comic() and previous comic.  I had tried to use these because that is what it seems like one is supposed to used based on what I see in the example theme, but when I use them, many posts loose the next and previous arrows entirely, and it seems even more is broken.  I tried just to swap out entirely my single.php with the one from example-themes/stripshow/single.php , and that breaks horribly, with the previous and next arrows often not showing up at all, and we can only navigate through about three comics.

Any ideas as to what might be happening here, how I can fix this breakage?

Let me know what additional information I can provide.

3:32 pm
March 31, 2009


Brad

Admin

posts 186

The first thing that comes to mind is this: The reason for the previous_comic and next_comic functions in the first place was that I couldn't get previous_post_link and next_post_link to do what I want. I'll give you an example.

Your code is:
<?php previous_post_link('%link','<img src="'.get_bloginfo('stylesheet_directory').'/images/previous
_day.gif" alt="Previous Comic" />','yes') ?>

As you know, the "YES" in the function means "within the same category."

Now look at your post 1137 — it's in two categories, comics and work. When you hit the NEXT link, you go to post 1139, which is also in work. So WordPress is just doing what it's supposed to do. It's going to the next post in the same category. Just not the comics category.

(The whole "in same category" thing made a lot more sense back when WP posts could only be in one category, don't you think?)

Feel free to PM me and we'll see what we can do about getting next_comic and previous_comic working right…

4:23 am
April 2, 2009


EddieC

Member

posts 7

Maybe add a parameter that specifies the category of the next/prev?

11:32 am
April 2, 2009


heinous

New Member

posts 2

Update:  So it turns out that the next and previous comic functions didn't work for me because of some breakage in the queries that they use that can happen sometimes when you have a lot of categories and term_taxonomy_id and term_id are not the same value.  It will be fixed soon, if not already in the code by monkeyangst, as he helped sort this all out.  I am testing some code that seems to be working better at this point.

3:51 pm
April 13, 2009


Brad

Admin

posts 186

This is fixed in 1.8.1, which I just noticed I forgot to link to in the plugin directory. Oops. It's been out for a few weeks now, but it wasn't being seen… now it should show up in your Plugins pages, if you're running WP 2.7.



  • Subscribe to Feed

    Enter your email address:

    Delivered by FeedBurner

  • Meta

  • Donate

    While I don't maintain stripShow for a living, I wouldn't say no to a little donation, if you think the plugin is worth it...

  • Advertisements