PDA

View Full Version : Previous Page link problem


doorlight
06-29-2008, 03:29 PM
I have this new WordPress theme and I don't understand why when I click the previous page link (page/2/ and up), the posts are the still the same, I mean the posts in the index are the ones showing.

My index.php

<div class="nextprevious">
<br />
<div class="left"><p><?php posts_nav_link('','','&laquo; Previous Entries') ?></p></div>
<div class="right"><p><?php posts_nav_link('','Next Entries &raquo;','') ?></p></div>


</div>

My page.php
<?php get_header(); ?>

<div class="post">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>


<h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>
<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?><br /><br /><?php edit_post_link('Edit','<span class="editlink">','</span>'); ?>
<?php endwhile; endif; ?>
</div><!--end post-->

</div> <!--end content-->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

style.css
.nextprevious {
margin: -25px 30px 30px 30px;
padding-bottom: 10px;
text-align: center;
}


Help!

davemcnally
06-29-2008, 03:34 PM
Not sure if this is it but the page navigation links for my own index.php are different to your code, here's mine:

<div class="older"><?php next_posts_link('&laquo; Older Entries') ?></div>
<div class="newer"><?php previous_posts_link('Newer Entries &raquo;') ?></div>

doorlight
06-29-2008, 04:02 PM
Vertexity, thanks I tried that but the link doesn't show at all.

weird. :(

davemcnally
06-29-2008, 04:39 PM
It sounds like a similar problem to that mentioned just recently here:

Featured Articles....How To? - TBE Blog Forum (http://www.theblogexperiment.com/blog-forum/showthread.php?t=1995)

Arwen
06-29-2008, 06:13 PM
Hi Doorlight,

It would seem like that code should work. Maybe try using the specific tags for Next and Previous.

The Next Posts tag code is <?php next_post_link(); ?>

The Previous Posts tag code is <?php previous_post_link(); ?>

Here are the pages on the WordPress Codex that explains exactly how to use them.

Previous Post Link info (http://codex.wordpress.org/Template_Tags/previous_post_link)

Next Post Link info (http://codex.wordpress.org/Template_Tags/next_post_link)

Hope this helps.

davemcnally
06-29-2008, 06:39 PM
Hi Doorlight,

It would seem like that code should work. Maybe try using the specific tags for Next and Previous.

The Next Posts tag code is <?php next_post_link(); ?>

The Previous Posts tag code is <?php previous_post_link(); ?>

Here are the pages on the WordPress Codex that explains exactly how to use them.

Previous Post Link info (http://codex.wordpress.org/Template_Tags/previous_post_link)

Next Post Link info (http://codex.wordpress.org/Template_Tags/next_post_link)

Hope this helps.

It would appear those are not working for her either as they are the tags I recommended above ;)

SarahG
06-29-2008, 11:46 PM
I've seen this problem before on my own sites. I believe it's down to a forward slash missing off the end of the link.

Anyway, I'd advise not to use those tags anyway, as they don't always have an output and that means you have an empty paragraph if there's no next or previous link (eg the front page doesn't have a next link) thus giving invalid code.

If you look in the classic theme you'll see they use the Template Tags/posts nav link WordPress Codex (http://codex.wordpress.org/Template_Tags/posts_nav_link) which seems to work better and that's what I now use on my site.

Arwen
07-02-2008, 10:36 PM
It would appear those are not working for her either as they are the tags I recommended above ;)

My bad. That's what I get for skimming :blush:

doorlight
07-03-2008, 02:56 PM
SOLVED. Thanks to SarahG. I was pestering her through e-mail. hehehe.

It was the looping thing in the index.php.

Thanks, guys! :D

ShaunFlair
09-12-2008, 07:28 AM
yes i think DIV can be create problem therefore you should tryin TABLE i thinks i will show properly