Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I would like to place content in a sidebar of my blog articles when they are viewed in the archive, but not show this content when the blog articles are shown on the main page of my site.

Can this be done?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Another approach: edit your theme files. archive.php can simply not call in the sidebar, and that will do what you're asking.

Have a look at the Template Hierarchy for a view of what the individual files in a theme take care of.

share|improve this answer
add comment

Wrap the content in a conditional:

if( is_archive() ){
  // Do stuff
}

More on conditionals here:

http://codex.wordpress.org/Conditional_Tags

share|improve this answer
add comment

I would recommend setting up multiple sidebars. Then you can call one sidebar for regular pages and a different sidebar for archive pages. This gives you complete control over which elements appear in the sidebar on each type of page.

Here's a good tutorial on creating multiple, widget-ized sidebars. You can manage each in the Appearance >> Widgets section of the admin dashboard.

share|improve this answer
add comment

Your Answer

 
discard

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.