Get post content from outside the loop
Is there a way to get the content from another outside the loop? The ID is 302 and I need to display the content of that on another page.
1
You can use get_page()
to return the $post
object of a static page:
$page_id = 302;
$page_object = get_page( $page_id );
echo $page_object->post_content;
Edit
Similarly, you can use get_post()
to return the $post
object of a post:
$post_id = 302;
$post_object = get_post( $post_id );
echo $post_object->post_content;