View Single Post
Old 08-07-2009, 22:52   #10 (permalink)
bazzle
Don't touch my tea!
 
bazzle's Avatar
 
Join Date: Aug 2007
Posts: 1,702
Send a message via MSN to bazzle
Quote:
Originally Posted by Pete Nice
so this is the code with Bazzle's pagination code added that doesn't work:

PHP Code:
<?php if (have_posts()) : ?>

        <?php $the_query = new WP_Query('showposts=10&orderby=post_date&order=desc');
            while (
$the_query->have_posts()) : $the_query->the_post();
            
$do_not_duplicate $post->ID?>
        <div id="post_date"><?php the_time('M'?><br /><span><?php the_time('d'?></span></div>
        <div id="post_title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></div>
        <div id="post_author">posted by <?php the_author() ?></div>
        <div id="post_comment"><?php edit_post_link('edit'''' '); ?><?php comments_popup_link('comment''1 comment''% comments'); ?></div>
        <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
        <div class="entry">
        <?php the_content('Read the rest of this entry &raquo;'); ?>
        <p class="postmetadata"><?php the_tags('Tags: '', ''<br />'); ?></p>
        </div>
        </div>
        <?php endwhile; ?>
            <div class="navigation">
            <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ''after' => '</p>''next_or_number' => 'number')); ?>
        </div>
        <?php else : ?>
        <div id="search_amount">Lost? Go back to the <a href="<?php echo get_option('home'); ?>/">home page</a></div>
        <?php endif; ?>

It doesn't work because you pasted it outside the loop. Paste it above the endwhile and it should work, like this:


PHP Code:
<?php if (have_posts()) : ?>

        <?php $the_query = new WP_Query('showposts=10&orderby=post_date&order=desc');
            while (
$the_query->have_posts()) : $the_query->the_post();
            
$do_not_duplicate $post->ID?>
        <div id="post_date"><?php the_time('M'?><br /><span><?php the_time('d'?></span></div>
        <div id="post_title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></div>
        <div id="post_author">posted by <?php the_author() ?></div>
        <div id="post_comment"><?php edit_post_link('edit'''' '); ?><?php comments_popup_link('comment''1 comment''% comments'); ?></div>
        <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
        <div class="entry">
        <?php the_content('Read the rest of this entry &raquo;'); ?>
        <p class="postmetadata"><?php the_tags('Tags: '', ''<br />'); ?></p>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ''after' => '</p>''next_or_number' => 'number')); ?>
        </div>
        </div>
        <?php endwhile; ?>
            <div class="navigation">
        </div>
        <?php else : ?>
        <div id="search_amount">Lost? Go back to the <a href="<?php echo get_option('home'); ?>/">home page</a></div>
        <?php endif; ?>


I'm guessing you might want the page numbers to appear outside the loop for layout reasons. I wouldn't know how to go about that, but there's probably a way you can.
__________________
  Reply With Quote