I want to display a single post in the sidebar-area (not the sidebar itself) and can't seem to get it working. I know the post_id (it's 1571 btw), so I looked around and only found this link from 7 years ago: Display Posts from a specific Category in the Sidebar

So after looking around, I found the useful functions "get_posts()" and "get_post()". First one requires an array which is not what I want as it is a single post. Second one.. well that's where I am so far:

<?php get_post('1571');?>

Can anyone please help me with this?

edit01: I am able to display the post's title by using

$post_id_1 = get_post($my_id); echo $post_id_1->post_title;

  • Since you're able to get the post title ( and other post object attributes ), what else are you trying to do that you need help with? What is your specific question?
    – Howdy_McGee
    Apr 17, 2015 at 14:31
  • Please do not abuse the php tag. :-) Apr 17, 2015 at 14:34
  • abuse? me? Nah : P I'm still learning the ropes of PHP so coding a template is hard work for me
    – theHubi
    Apr 17, 2015 at 14:43

1 Answer 1


get_post() returns a post object. So you can try the following

$post = get_post( 1571 );
setup_postdata( $post );
  • My pleasure. Off to the weekend now :-). Enjoy Apr 17, 2015 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.