0

I wanted to loop through these four pages. Basically I would like my loop create a "li" by "page_id". I just know this is from my "new WP_Query" which is not good.

How would you be doing? Here is my code:

<ul>
<?php $query = new WP_Query('page_id=50' || 'page_id=53' || 'page_id=56' || 'page_id=58'); ?>
<?php while ($query->have_posts()) : $query->the_post(); ?>
    <li>
        <?php the_field('my-content'); ?>
    </li>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</ul>
1

Use the proper parameter. Try this:

$post_ids = array( 50, 53, 56, 58 );
$query = new WP_Query('post__in' => $post_ids );

More info

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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