• I can’t get this figured out…

    When I go to page/2 on my domain the contents from page 1 are displayed. I can’t get to old posts.

    Here’s what I think is the problem:

    I have a category excluded from the main post and displayed in the sidebar – I have used the following code in my index.php:


    <?php get_header(); ?>

    <div id="content">
    <?php if (is_home()) {query_posts("cat=-11");}?>
    <?php if (is_page()) {query_posts("cat=-11");}?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post">
    <h2>" title="<?php the_title();?>"><?php the_title(); ?></h2>
    <div class="entry">
    <?php the_content();?>
    <?php wp_link_pages();?>
    <?php edit_post_link('Edit','<p>','</p>');?>
    </div>

    <div class="comentarii">
    <?php comments_popup_link('There are no comments', 'One Comment', '% Comments', 'comments-link', 'This post does not allow comments'); ?>

    <div class="meta">
    <p><?php the_time('l, j F Y'); ?>, <?php the_time('G:i'); ?> | Category : <?php the_category(', '); ?>
    Tags : <?php the_tags('',', ',''); ?></p>
    </div>
    </div>
    <?php endwhile; ?>
    <?php endif; ?>
    </div>

    <div class="navigation">
    <?php previous_posts_link(); ?> <?php next_posts_link(); ?>
    </div>

    <?php wp_reset_query(); ?>
    </div>

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

    Then, my Sidebar Code is as follows:

    <div class="sidebar">
    <h2>Curiosities</h2>

    <?php
    $myPosts = new WP_Query();
    $myPosts->query('showposts=20&cat=11');
    while ($myPosts->have_posts()) : $myPosts->the_post(); ?>
    <h1>" rel="bookmark"><?php the_title(); ?></h1>
    <?php the_content();?>
    <div class="comentarii">
    <?php comments_popup_link('There are no comments', 'One Comment', '% Comments', 'comments-link', 'This post does not allow comments'); ?>

    <div class="meta">
    </div>
    </div>
    <?php endwhile; ?>
    <?php wp_reset_query();?>
    <h2>>> More Curiosities</h2>
    <p>
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Sidebar 2") ) : ?>

    <?php endif; ?>

    </div>
    <div class="sidebar1">

    <div class="rss">
    "><img src="<?php bloginfo('template_url'); ?>/images/rss_feed.png" alt="RSS FEED" title="Subscribe using RSS" /><p>
    </div>
    <div id="search_id">
    <form method="get" id="searchform" action="<?php bloginfo('home'); ?>">
    <div id="search">
    <input type="text" value="" name="s" id="s" class="text" />
    <input type="image" id="searchsubmit" src="<?php bloginfo('template_url');?>/images/search_s.png" value="Search" alt="Search" class="button" />
    </div>
    </form>
    </div>

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Sidebar 1") ) : ?>

    <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>

    <?php wp_list_bookmarks(); ?>

    • <h2>Archives</h2>
      <?php wp_get_archives('type=monthly'); ?>

    <?php endif; ?>

    </div>

    Any pointers would be greatly appreciated – my site is here.

Viewing 1 replies (of 1 total)
  • As has been mentioned several times here in the forums, using query_posts messes up your pagination because makes *you* define what you want done with your posts. If you want pagination, you have to define it. There’s a few solutions on how to fix it. (Kafkaesqui is the man.)

Viewing 1 replies (of 1 total)
  • The topic ‘Loop Issue – Archive pages not working’ is closed to new replies.