• Ashe Abbott DiBlasi

    (@asheisarockstar)


    Hi there!

    I really need some help, and I’m hoping one of you fabulous folks has a solution for me.

    I have a static homepage on which I have several custom loops. I’m using WordPress largely as a CMS, so it’s mostly custom loops. On the second loop, I need to implement pagination. When I do so (or try, anyway), I get a “Next Page” link, but when I click on it, it just reloads the same page, adding /page/2 to the end of the domain.

    I’ve read through probably 50 posts around the internet on this same topic, but nothing I’ve tried is working. Perhaps you guys could look at my code and give me a hand?

    Here’s what I have:

    //First Custom Loop (wp_query)

    <?php wp_reset_query(); ?>

    <h2>Latest Blog Posts</h2>
    <ul class=”blog” style=”margin-left: 10px;”>

    <?php global $wp_query;

    $ids = array();

    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    $wp_query = new WP_Query(“post_type=post&post_status=publish&showposts=1&paged=” . $paged);

    if ( have_posts() ) : while ( have_posts() ) : the_post();

    $id = get_the_id();
    if (has_post_thumbnail()) {

    }

    $permalink = get_permalink( $id );

    ?>

    • // Stuff
    • <?php endwhile; else: ?>

      <p>Coming Soon!</p>

      <?php endif; ?>

      <?php next_posts_link(); ?>
      <?php previous_posts_link(); ?>

      <?php wp_reset_query(); ?>

      </div>

    Thank you so much!! 😀

Viewing 1 replies (of 1 total)
  • Change:
    $wp_query = new WP_Query("post_type=post&post_status=publish&showposts=1&paged=" . $paged);
    to:
    $wp_query = new WP_Query('post_type'=>'post','post_status'=>'publish','showposts'=>1,'paged'=>$paged);

Viewing 1 replies (of 1 total)

The topic ‘Pagination on Custom Loop Reloads Same Page’ is closed to new replies.