08-07-2009, 04:49
|
#5 (permalink)
|
|
Crankshaft
Join Date: Apr 2003
Posts: 2,086
|
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 »'); ?> <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; ?>
this is the tutorial code that works but doesn't include the if statements
PHP Code:
<?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query('showposts=5'.'&paged='.$paged); ?> <?php while ($wp_query->have_posts()) : $wp_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 »'); ?> <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></p> </div> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php previous_posts_link('« Previous') ?></div> <div class="alignright"><?php next_posts_link('More »') ?></div> </div> <?php $wp_query = null; $wp_query = $temp;?>
the same code within the if statements that gives me the 'next entries' link but when clicked I get the if statement 'no post - go to the homepage'
PHP Code:
<?php if (have_posts()) : ?> <?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query('showposts=5'.'&paged='.$paged); ?> <?php while ($wp_query->have_posts()) : $wp_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 »'); ?> <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></p> </div> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php previous_posts_link('« Previous') ?></div> <div class="alignright"><?php next_posts_link('More »') ?></div> </div> <?php $wp_query = null; $wp_query = $temp;?> <?php else : ?> <div id="search_amount">Lost? Go back to the <a href="<?php echo get_option('home'); ?>/">home page</a></div> <?php endif; ?>
Last edited by Pete Nice : 08-07-2009 at 05:09.
|
|
|
|