WordPress.org

Ready to get started?Download WordPress

Forums

Pagination Sidebar (4 posts)

  1. makecg
    Member
    Posted 4 years ago #

    Hello WordPress community.

    was wondering if it is possible to paginate certain wordpress sidebar items

    Like I have a sidebar called "Projects" and I want it to show a list of 12 After 12 It would go into pages or Next / prev buttons.

    Hope you understand is it possible to do?

  2. rwilki
    Member
    Posted 3 years ago #

    i'm looking for the same thing and can't find an answer...

  3. ryansebiz
    Member
    Posted 3 years ago #

    Me too. Any ninjas around?

  4. rwilki
    Member
    Posted 3 years ago #

    I think I've found a solution that actually works for me. It's not perfect and not paginated, but it does allow linking to older or newer links...

    <?php
    $postIDs = array();
    $pageChildren = get_pages('child_of=' . $post->ID);
    if ( $pageChildren ) {
      foreach ( $pageChildren as $pageChild ) {
        $postIDs[] = $pageChild->ID;
      }
      $paged = (intval(get_query_var('paged'))) ? intval(get_query_var('paged')) : 1;
      $args = array(
        'post_type' => 'page',
        'paged' => $paged,
        'post__in' => $postIDs,
     	'post__not_in'=> array(1768),
        'posts_per_page' => 15
                    );
      query_posts($args);
      if (have_posts()) : while (have_posts()) : the_post(); ?>
    <li><a href="<?php echo get_permalink($post->ID);?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?>
    <?php endif; ?>
    <?php } ?>
    <!-- End Code -->
    </ul>
    <div style="margin:10px 0 0 0; border-top:1px dotted #999;"></div>
    <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>

Topic Closed

This topic has been closed to new replies.

About this Topic