Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.
            <ul id="post-list">
            <?php

            $IDOutsideLoop = $post->ID;
            global $post;

            $args = array( 'numberposts' => 7 );
            $myposts = get_posts( $args );
            foreach( $myposts as $post ) :  setup_postdata($post); ?>
                <li <?php if ($IDOutsideLoop == $post->ID) { echo " class=\"current\""; }?>>
                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?><br /><span><?php the_author(); ?></span></a>
                </li>

            <?php endforeach; ?>

            <?php my_paginate_links(); ?>

            </ul>

The pagination shows up but it shows too many pages (there aren't even that many posts) and when I click on 'next', the url in the address bar shows /page/2 but nothing changes and the page doesn't actually go to page 2, if that makes sense. I think something needs to be added to the code above but I am not sure what. Does anybody have the slightest clue?

share|improve this question

closed as not a real question by toscho Jul 13 '12 at 20:02

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

1 Answer

$args that you use in get_posts() are always same so you get same posts so how would pagination work?

You need to adjust posts retrieves, see WP_Query in Codex, especially parts about paged query argument.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.