Trouble with previous/next
-
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; ?>
-
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 usedclass="invisible"and it worked.Also, check these as there may be information on replacing these tags with links:
http://codex.ww.wp.xz.cn/Good_Navigation_Links
http://codex.ww.wp.xz.cn/Next_and_Previous_Links
http://codex.ww.wp.xz.cn/Template_Tags/previous_post
http://codex.ww.wp.xz.cn/Template_Tags/posts_nav_link
The topic ‘Trouble with previous/next’ is closed to new replies.