[resolved] PHP include to display one particular post (6 posts)

  1. jrelgin
    Posted 4 years ago #

    Hi All,

    I would like to display a message on my site that I will change occasionally. I thought it may be best to do this through a post that I occasionally edit the copy on. I want this message on every page so I plan to put it in my header.php.

    I'm not sure what function and parameters to call for this. I've tried:
    <?php query_posts('p=5'); ?>

    Am I on the right track or is this the wrong way of doing this?

    Thanks in advance!

  2. Michael
    Forum Moderator
    Posted 4 years ago #

    good start;

    you will need the loop to output the post:

    and you will need to reset the query to have everything as it is for the rest of the page:

    using 'get_post()' is another possibility:

  3. jrelgin
    Posted 4 years ago #

    Great! Thank you alchymyth. You have definitely put me on the right track.

    What I'm trying to figure out now is how to display the post content and not the post title. Any suggestions?

    Thank you again

  4. Rev. Voodoo
    Posted 4 years ago #

    withing your loop... just call the_content, and don't use the_title

  5. jrelgin
    Posted 4 years ago #

    thank you both—its working perfectly! I'm sure by now you can tell I'm a newb but thanks to people like you two, i'm learning!

  6. Rev. Voodoo
    Posted 4 years ago #

    Gotta start somewhere, the codex, google, and these forums will be your friend!!

Topic Closed

This topic has been closed to new replies.

About this Topic