How do I get the $post Variable in a WP_Query started loop? I have to get the excerpt, raw $post->post_content and further things. This is why I have to get Access to the Variable itself.
How am I able to do this?
Thank you in advance!
$query = new WP_Query( $args );
while( $query->have_posts() ) {
// this fills in the $post global with the next post from the query
$query->the_post();
// we're now ina classic wordpress loop, and can use all the usual stuff
the_title();
the_content();
echo $post->post_content;
}
// lets clean up after ourself so else we might mess up other queries and function calls
wp_reset_postdata();
$your_query = new WP_Query( $args );
while( $your_query->have_posts() ) :
$your_query->the_post();
echo $your_query->post->post_content;
endwhile;