• unaspiring

    (@unaspiring)


    I have this code on my main page, I’m trying to get a photo up that you can hit previous on to go to the previous entry in that category, but neither the previous nor next links show up. I use this query because I have another query elsewhere on the page to list entries from another category.

    Any ideas?

    <?php query_posts(‘category_name=photoblog&showposts=1’); ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php the_content(‘Read the rest of this entry »’); ?>

    <?php previous_post(‘%’, ‘← previous’, ‘no’,’yes’); ?>
    <?php next_post(‘%’, ‘next →’, ‘no’,’yes’); ?>
    <?php endwhile; ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • Lorelle

    (@lorelle)

    Do you mean that you want a graphic or photo image to replace the NEXT and PREVIOUS link text? I’m a bit confused. Can you show us an example or be more specific?

    Lorelle, that’s what I want to do! I can figure out how to insert a graphic, but eliminating the post title is another matter. If I remove ‘%’ from the code below, then nothing appears.

    <div class="navigation">
    <div class="previous"><?php previous_post('%', '<img src="/wp-content/themes/beatrice/images/previous.gif" />', 'yes'); ?></div>
    <div class="next"><?php next_post('%', '<img src="/wp-content/themes/beatrice/images/next.gif" />', 'yes'); ?></div>
    </div>

    Anybody know to how remove the text portion, leaving only graphic next and previous links?

    Got it!

    CSS
    .hidden {
    color:#fff;
    height:0px;
    font-size:0px;
    line-height:0px;
    }

    PHP/XHTML
    <div class="navigation">
    <div class="previous"><?php previous_post('<span class="hidden">%</span>', '<img src="/wp-content/themes/beatrice/images/previous.gif" />', 'yes'); ?></div>
    <div class="next"><?php next_post('<span class="hidden">%</span>', '<img src="/wp-content/themes/beatrice/images/next.gif" />', 'yes'); ?></div>
    </div>

    Sigh. The above code doesn’t work for Opera 8, where the minimum font size is defaultedto 6 pixels and does not allow a zero sized font. Argh.

    Instead of setting the font size to zero, use display:none.

    On my old site, I had a little php code that would “show” on a page so I created this:

    .invisible {display:none}

    And when needed, like you are doing with hidden, I used class="invisible" and it worked.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Trouble with previous/next’ is closed to new replies.