Forums

The WordPress MU forums have moved to the MultiSite forum on WordPress.org

wp_query problem with cutom page loop (3 posts)

  1. mattloak
    Member
    Posted 2 years ago #

    I just migrated a site over from WP to WPMU and all went fine except for one page that no longer works. It was a page template that had a custom loop of pages using the following code:

    <?php $page_query = new WP_Query('post_type=page&post_parent=2&orderby=ID&order=ASC&showposts=20'); ?>
            <?php while ($page_query->have_posts()) : $page_query->the_post(); ?>
            <!-- Post Starts -->
            <div class="post wrap"> 
    
              <a href="<?php the_permalink() ?>">
    
              <h2 class="author_title"><?php the_title(); ?></h2>
              </a>
              <h3 class="author_title"><?php echo get_post_meta($post->ID, "auth_title", $single = true); ?></h3>
    		<p><?php echo get_post_meta($post->ID, "page_excerpt", $single = true); ?> <a href="<?php the_permalink() ?>" class="more">Read More >></a></p>
            </div>
              <?php endwhile; ?>

    Now that I'm on WPMU that page is blank. Its not breaking the template, the header and footer still show but the content area is completely blank. I have searched for a while for all the different functions but couldn't find anyone with similar problems. Anyone have any insight why this loop is not working on WPMU?

  2. tmoorewp
    Member
    Posted 2 years ago #

    Check your post_parent variable in the WP_Query string. That likely changed in your migration. Otherwise it looks like the code should work.

  3. mattloak
    Member
    Posted 2 years ago #

    Thanks Tim, that was it! I'm a little embarrassed that I didn't catch that myself. I get so frustrated with code sometimes I am quick to assume that there is some big complicated problem.

Topic Closed

This topic has been closed to new replies.

About this Topic