J
J
jamster2018-04-04 15:30:30
WordPress
jamster, 2018-04-04 15:30:30

Display specific posts WP_query?

Good day, dear experts. Basically I ran into a problem.
The task is to set the appropriate page IDs for the Wp_Query class, which are taken from the custom field, ACF Object field. Received page IDs.
What was done.
1. Page IDs are received - as numerical values ​​int(151) int(91), etc.
2. I pass the value to the post__in parameter Looks like this 'post__in' => array($mypost1
) first ), and accordingly only one page is displayed.

<?php 
        $queryz = get_field('page_toarticles');
        foreach ($queryz  as $post) {

        $mypost = $post->ID;
        $mypost1 = strval($mypost);

        $args = array(
         'post_type' => 'page',
         'post__in' => array($mypost)
        )}

        $myquery = new WP_Query($args);
        var_dump($myquery);
        ?>

Next is the normal cycle. Displays only 1 page :(
Actually, the question is how to put all the values ​​into the parameter? Many thanks in advance for the answer!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2018-04-04
@Minifets

Merge all data into 1 array, via array_merge

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question