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?
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?
You must be logged in to post a comment.
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.
Wrap the content in a conditional:
More on conditionals here:
http://codex.wordpress.org/Conditional_Tags
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.