Grow your CSS skills. Land your dream job.

wp_list_pages inconsistencies!

  • # June 17, 2010 at 4:05 pm

    Okay… this is really frustrating. I don’t know if my host is having database issues or what, but if I use the same code for 2 different pages they don’t work the same (after changing the few instances of the name, of course). For example:

    Genre template

    Code:
    < ?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    < ?php the_title(); ?>

    < ?php
    if (get_the_title() == "MMORPG") {
    echo "(Massively Multiplayer Online Role-playing Game)";
    } elseif (get_the_title() == "FPS") {
    echo "(First Person Shooter)";
    } elseif (get_the_title() == "RTS") {
    echo "(Real-time Strategy)";
    } elseif (get_the_title() == "Action RPG") {
    echo "(Action Role-playing Game)";
    }
    ?>
    < ?php endwhile; endif; ?>
    < ?php
    $genre = get_the_title();
    ?>

      < ?php
      $children = wp_list_pages('title_li=&echo=1&meta_key=Genre&meta_value=' . $genre);
      if ($children) { ?>
      < ?php echo $children; ?>

    < ?php } ?>

    Now, that template is used by http://mac.gamingapple.com/genres/mmorpg/ (where the list is displayed correctly) and http://mac.gamingapple.com/genres/rts/ (where the list is displayed incorrectly). All of the children of Genres work fine except RTS, for some reason. I can’t figure out what the difference of outputs is between all the Genre children and RTS…

    In addition to the RTS page being displayed incorrectly, other parents like http://mac.gamingapple.com/game-modes/ have all their children being displayed incorrectly. Each parent has its own template (Genres, Game Modes, etc) but they all use the same code, except for the few instances of changing a name. I don’t get it. The pages display all the right information, but they display it differently even though they use the same code…

    The only thing I can think of is that my hosting company is messing up or something, but I can change the template, upload it and it will be changed. It’s just the part about the correct design of the list. My code could be wrong, but I don’t know why in some instances it would work while in other same instances, it wouldn’t :(

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".