I need to call the wp_get_recent_post a second time on the same page.
Basically I need to call this code twice(with different categories).
$args = array( 'numberposts' => '4', 'category_name' => 'category', 'orderby' => 'date' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ):
....
endforeach;
I read about rewind_posts()
but I don’t understand where to put it (as the examples in the docs are using other functions to get the posts data).
Could you explain the best way to deal with this?
Links to clear examples would be appreciated.
thanks!
I’m not sure what your question is; have you tried calling this twice? What happened?
That said I think you’re going to need to add
wp_reset_postdata()
right after eachendforeach;
to keep the rest of your page clean.