Show One WordPress Post

Show One WordPress Post

There is a great function you might be aware of that allows you to get one WordPress post and display it anywhere you would like (header, sidebar, home page, etc).

To show only one post, use the function get_post.

Example:

post_title;
$sdac_content = $show_post_id->post_content;
?>
<h2></h2>
 

The code above will show the title and content of the post with the post ID of 10. If you are not sure what your post ID is, go to the manage screen in the WP-Admin, and hover over the post title. In your browser status bar, you will see the URL – and the post ID is the number at the end of the URL.

6 thoughts on “Show One WordPress Post”
  1. Adriano |

    I was looking to something like this , but I have adoubt , to add a READ MORE , how can be done thisn??

    THnaks!!

  2. jzelazny |

    Are you looking for the read more to be added when you add in a MORE tag or do you want to hard code it?

  3. Adriano |

    Hey Hi.. thanks for the Answer.!

    well I eman harecoded , for example :

      
     1.
          post_title;
       4.
          $sdac_content = $show_post_id->post_content;
       5.
          ?>
       6.
          
       7.
          
    
    

    Adding to the above code the possibility to get the read more if it is one..

    is it possible… ?

    thanks

  4. Danny |

    Hi
    great post!
    I was looking for that
    however.. I have a question:
    I was using contact form 7 plug in and
    put it in a post. then.. tried to show the form on
    my homepage using your method and for some reason it won’t work.
    simple post worked fine but plug in not.
    any idea? any addition to the code?
    thanks

  5. Peter V. |

    Thanks Jennifer! So much more succinct and complete than the WordPress codex entry on this function.

  6. Mobile |

    Hi!,

    I want to show complete post while opening RSS feed of my blog (http://www.cheapmonthlymobile.co.uk/blog/). How can i do that? I already enabled “Full Text” option in reading section, but doesn’t works? Help Me!!!

Leave a Reply

Your email address will not be published.
*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.