I'm using a custom query on a page after the initial loop to list some posts from a category I'm associating with that page. Im doing this:
query_posts(array(
'category_name' => $name,
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => 1,
'paged' => $paged));
I've also tried using get_query_var('paged')
in place of $paged btw.
then I do my loop and it shows the correct number of posts, 1. I actually am getting links generating on the page if I use previous_posts_link()
or next_posts_link()
, however, if I use echo paginate_links()
after or even in my loop, no links are generated and where as I have 2 posts in that category currently so I expect to see at least a link to page 2. It seems like there is a lot of info out there about passing the correct info to query_posts for this instance but not what function to use to actually render the pagination links so i'd appreciate any insight. Thanks.
Edit:(full code)
<div id="left_column_wrap">
<?php
if (have_posts()) : while (have_posts()) : the_post(); ?>
<article class="post" id="post-<?php the_ID(); ?>">
<h1><?php the_title(); ?></h1>
<?php //include (TEMPLATEPATH . '/_/inc/meta.php' ); ?>
<div class="entry">
<?php the_content(); ?>
<?php //wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
</div>
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
</article>
<?php endwhile; endif;
$name = '';
if(isset($pagename))
{
$name = $pagename;
}
if($name == '5a' || $name == '4a' || $name == '3a' || $name == '2a')
{
echo '<div id="all_cats_recent_posts_wrap">';
query_posts(array('category_name' => $name, 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => 1, 'paged' => $paged));
if (have_posts()):
while (have_posts()):
the_post(); ?>
<article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<?php include (TEMPLATEPATH . '/_/inc/meta.php' ); ?>
<div class="entry">
<?php echo substr(strip_tags(get_the_content()), 0, 280).'...';?>
<a class="quick_link" href="<? the_permalink()?>">(read more...)</a>
</div>
</article>
<?
endwhile;
echo paginate_links();
?>
<div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
<div class="alignright"><?php next_posts_link('More »') ?></div>
<?
endif;
echo '</div>';
}
?>
</div>
query_posts
. Create a newWP_Query
object instead. Please post all the code related to attempt atpaginate_links
. I am guessing you are using it for something it isn't intended for, but post the code and let's see.