If you’d like to display post info outside of the loop, you can use the
get_post function, use the following code snippet:
<?php $thePost = get_post( POST_ID ); echo '' . $thePost->post_title . ''; echo '' . $thePost->post_content . ''; echo '' . $thePost->post_excerpt . ''; echo '' . $thePost->post_author . ''; ?>
POSTID, on line 2, to the ID of the post. You can also create a variable that holds the post ID value and change
POSTID to that variable, like so:
<?php $postIDvalue = 100; $thePost = get_post( $postIDvalue ); // ...what you want to display goes below... ?>
To display the field, use
X is the post field name. You can see a list here.