How can I include a post in a theme?

Sometimes it might be necessary to include frequently-changing content in a theme, but themes take some time to modify, it may also be necessary to let a non-technical user maintain some content that appears on more than one page. Is it possible (without heavily impacting performance) to include a post in a theme?

alt text

Related posts

Leave a Reply

3 comments

  1. You can but I think it’s far more easier for you theme to add a sidebar and then place a text-widget (or any other widget) inside there because that’s far more flexible.

    What you describe I did for some sites longer ago. You can just load the post and display it. I used query_posts() to get the post(s) and then have_posts(), query_posts(), the_content() and so on to display it within the template files (e.g. probably footer.php in your case).

  2. You should definitely use a widget to achieve this functionality, rather than hardcoding a call to a particular post in your theme. There are plugins that extend the widget functionality and make it easy to control which pages the widgets appear on.

  3. There are several ways to do that:

    1. Include a page (that does not appear in the menu)
    2. Include a post
    3. Add an option page to the theme, this page will include the text field you need here.

    Options 1,2 can be implemented using query_posts.
    Option 3 can be foind here