Question

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

Was it helpful?

Solution

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).

OTHER TIPS

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top