How to resolve multiple get_post() queries to just one
-
I’m building a template and using elements from 4 posts outside the main loop. At the moment I am calling the posts like this :
$post_id=24; $statement = get_post($post_id); wp_reset_query(); $post_id=27; $resume = get_post($post_id); wp_reset_query(); $post_id=31; $contact = get_post($post_id); wp_reset_query(); $post_id=44; $otheracts = get_post($post_id); wp_reset_query();
This allows me to use, for example,
$resume-> post_title
as and where I want it, as I can with the other variables I’ve assigned to each post.
Is there a more efficient (one query instead of four) way of doing this ?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘How to resolve multiple get_post() queries to just one’ is closed to new replies.