WordPress.org

Ready to get started?Download WordPress

Forums

Paging of custom post types (1 post)

  1. bananasontoast
    Member
    Posted 4 years ago #

    First I do a loop to output the first 6 items that are of type "portfolio".

    <?php
    	// This first line doesn't seem to work, it always seems to return 1 when echoed out
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 6, 'caller_get_posts'=>1, 'paged' => $paged));
    	while ( $loop->have_posts() ) : $loop->the_post();
    	$custom = get_post_custom($post->ID);
    	$screenshot_url = $custom["screenshot_url"][0];
    	$website_url = $custom["website_url"][0];
    ?>

    Here I do some stuff to output the items...

    <?php endwhile; ?>

    Then do the paging links for next and previous - this part doesn't work...

    <div class="navigation">
      <div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
      <div class="alignright"><?php next_posts_link('More »') ?></div>
    </div>

    So to recap...

    1. The statement using get_query_var('paged') isn't working
    2. The previous_posts_link and next_posts_link links are not working either

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by bananasontoast
  • This topic is not resolved
  • WordPress version: 3.0.1