WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are widgets meant to be used outside of sidebars?

My case: I have this html block which I want to use every time I display a post with category of "Story". I was going to make a widget to reduce duplicate code. Is there a better way to apply this html block to every displaying of a "Story" post?

share|improve this question
up vote 1 down vote accepted

If the category is Story, then make a template file, and name it as category-story.php (make sure the slug is 'story'). Put your code in this file. WordPress will automatically display the posts from Story category using this template. (More about category templates here). And yes, you can use widgets outside of the sidebar, read how.

share|improve this answer

I frequently use widgets outside sidebars. It's a fantastic way to make editing content in WordPress easier, however in your situation you may wish to use a file named 'category-story.php' or use the is_category() conditional tag to display content when a given category is viewed.

share|improve this answer

Widgets are just placeholders with enhanced functionality. I build a plugin once to add widgets to the head and footer sections of an HTML document.
I’d say it depends on your needs: If you need some configuration use a widget. Otherwise shortcodes or special templates may do the same job.

share|improve this answer

Yes, one common use is the Widgetized Footer. The typical ones enable one to put three or four columns in the footer which you populate via widgets.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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