• Hope somebody can tell me what is wrong here. This loop displays the latest 7 posts, and also displays an “older post” link at the bottom of the page, which brings me to: mysite/blog/page/2/. But this shows me the exact same 7 posts as the previous page (mysite/blog/).

    Note: /blog is a custom page with its own template: loop below.

    <?php if(have_posts()) : ?>
    
    	<?php query_posts('showposts=7&paged=');while (have_posts()) : the_post();?>
    
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    				<div class="entry">
    					<?php the_content('Read the rest of this entry ??Ω'); ?>
    				</div>
    
    				 <p class="postmetadata"><?php the_time('F jS, Y') ?> | Posted in "<?php the_category(', ') ?>" | by <?php the_author() ?> | <?php edit_post_link('Edit','',' |'); ?> <?php comments_popup_link('No Comments ', '1 Comment ', '% Comments '); ?></p>
    
    		</div>
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    		</div>
    
    <?php endif; ?>

    Thanks for reading and for any help.

    W

Viewing 10 replies - 1 through 10 (of 10 total)
  • Not sure if I understand what you;re trying to do but try:

    <?php if !is_paged()) query_posts('showposts=7&paged=');>
    <?php if(have_posts()) : while (have_posts()) : the_post();?>

    https://codex.www.ads-software.com/Conditional_Tags#A_Paged_Page

    Thread Starter mrwolfy

    (@mrwolfy)

    Hi Esmi, thanks!

    What I am trying to do is to figure out why wordpress will not show me the next latest posts when I go to the “older entries” link. It shows me the same seven posts as the previous page.

    W

    Because you’ve only asked for 7 posts to be retrieved?

    query_posts('showposts=7&paged=')

    Thread Starter mrwolfy

    (@mrwolfy)

    Ok, well I don’t know php that well. So the ‘showposts=7&paged=’ argument will only allow those latest 7 posts to show up? And this loop wont display the previous posts no matter what?

    What I want is to define the number of posts on this page, and also link to the older post that formerly displayed on this page. Older posts, previous page, whatnot.

    I am doing this because I have a custom loop on this page, my “blog page”. The rest of my pages are set up by WP-Admin to only display 4 posts, as I want. So I am trying to find a way to define the number of posts to be displayed on this one page, and to feature a link on the bottom to previous posts.

    Thanks for your interest.

    eighteesix

    (@eighteesix)

    hello– i am also having this identical issue. clicking ‘older entries’ shows the same entries. i have no idea why its not showing.

    the /blog/ page is a Page with a custom template (called blog.php).

    heres the loop i put in blog.php:

    <?php if (have_posts()) : ?>
     <?php query_posts('cat=3'); ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    <div class=regular><div class=date><span style='color:#999; text-transform: lowercase;'><php the_bookmark_links(); ?><?php the_author() ?> | <?php the_time('M Y') ?></span></div><?php the_title(); ?><p><p><?php the_content('Read the rest of this entry &raquo;'); ?></p><?php if (function_exists('sociable_html')) { echo sociable_html(Array("Facebook", "Twitter", "MySpace", "del.icio.us", "Google", "Mixx", "Digg", "RSS", "email", "Print")); } ?></p>
    
    				<p class="postmetadata"><?php edit_post_link('Edit', '', ' | '); ?><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
    </p>
    			</div>
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    		</div>
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    		<?php get_search_form(); ?>
    
    	<?php endif; ?>

    would really appreciate any help.

    Michael

    (@alchymyth)

    try and change this:

    <?php if (have_posts()) : ?>
     <?php query_posts('cat=3'); ?>

    into:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('cat=3&paged='.$paged); ?>
    <?php if (have_posts()) : ?>

    eighteesix

    (@eighteesix)

    you sir, are a gentleman and a scholar.

    unless youre female, then thank you so much!

    eighteesix

    (@eighteesix)

    one last question. if when i click on the comments link of a post from my blog page (my blog is category 3 only) and it goes to the single post page, and the links at the top for NEXT and PREVIOUS post appear, what code can I use so that those links ONLY show next or previous posts from category 3 (the blog) ?

    thanks!

    eighteesix

    (@eighteesix)

    nevermind, found it!

    <?php next_post_link('%link', '%title', TRUE) ?>

    OK guys, I have the same issue. I have tried many things but I just cannot get it to work. I NEED:
    – Previous entries and Older entries to be visible (I managed to achive it, but the next problem fucked up the things)
    – The Previous and Older links go to paged=1,2,3 – for the 12 posts I have (5 per page), however I DO NOT SEE THE DIFFERENT POSTS BUT ONLY THE first 5 no mater whether it is page 1,2 or 3.

    Please help!

    Here is the index.php of the theme:

    <?php get_header(); ?>
    
    			<div id="main" class="grid_8">
    
    				<?php $more1 = get_option('woo_more1_ID'); ?>
    
        			<?php query_posts('page_id=' . $more1); ?>
    
    				<?php if (have_posts()) : while (have_posts()) : the_post(); ?>					
    
    		<div class="entry">
    
            <h2><?php the_title(); ?></h2>
    
    		<?php the_content(); ?>
    
            </div>
    
      <?php endwhile; endif; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    		</div>
    
                    <?php
    
            		if( get_option('woo_show_carousel')  == 'true' ){ include(TEMPLATEPATH . '/includes/category_carousel.php'); }
    
        			?>
    
    			</div><!-- / #main -->
    
    <!-- <?php get_sidebar("home"); ?> -->
    <?php get_sidebar("2"); ?>
    <?php get_footer(); ?>

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Older entries link not working’ is closed to new replies.