wp_query for posts ids
-
Hey there,
I’m getting in trouble by creating a post query, with is ending in an $variable with post IDs inside. I hope you can help me. 🙂
My final result variable should look like this:
Content of $slogan: “23, 13, 34, 35”! This Code should work inside of my header.php !
This is the code i have created so far:
// ID of current page global $post; $pid = $post->ID; // ID of Slogan Posts // WP_Query arguments $args = array ( 'post_type' => 'header-slider-type', 'cat' => '68', 'order' => 'DESC', 'orderby' => 'date', ); // The Query $slogan = new WP_Query( $args ); // The Loop if ( $slogan->have_posts() ) { while ( $slogan->have_posts() ) { $slogan->the_post(); $slogan->get_the_ID(); } } else { _e( 'Sorry, no posts matched your criteria.' ); } // Restore original Post Data wp_reset_postdata(); wp_reset_query();Thank you!!!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘wp_query for posts ids’ is closed to new replies.