Fake out wordpress to pull in another page-content..
Sometimes using <? $thispost=get_post($id); echo $thispost->post_content ?> isn’t enough.
Sometimes, you need a full menu structure to be highlighted or built according to that post.
Sometimes you need a menu parent pull in the ‘first child’ content.
Sometimes, you need to fake wordpress out:
<? //Usage: given, any time this template is called and happens to be on page_id '6' make page '6' act like page '8'.
$wp_query=fakePage($wp_query->post->ID,"6","8",$wp_query);
function fakePage($currid,$thisid,$fakeid,$wp_query){
if(strcmp($currid,$thisid)==0){
$thispost=get_post($fakeid);
//the fake-out
$wp_query->post->ID=$fakeid;
$wp_query->post->post_content=$thispost->post_content;
$wp_query->queried_object->ID=$fakeid;
$wp_query->queried_object_id=$fakeid;
$wp_query->queried_object->post_content=$thispost->post_content;
$wp_query->posts[0]->ID=$fakeid;
$wp_query->posts[0]->post_content=$thispost->post_content;
}
return $wp_query;
} ?>
No Responses