About the Extension
Taxonomy Sidebars is a plugin for WordPress that extends its functionality by allowing to add custom sidebars and widgets on different WordPress taxonomy pages. This versatile extension works with any WordPress plugin that creates custom taxonomies! The plugin is absolutely useful when you want to add widgets to certain WordPress taxonomies only. Not only does it make your site clearer, but it also gives more opportunities when using advanced WordPress plugins, including e-commerce systems like Jigoshop or WooCommerce.
Installation
-
Connect to your server’s FTP
-
Copy the “taxonomy-sidebars” folder from the zip into the “wp-content/plugins” directory
-
Login to your WordPress administrator panel
-
Click the “Plugins” tab and you will see your newly installed plugin – activate it.
How it works & configuration
Let’s test how the plugin works with basic WordPress taxonomies – post categories and tags.
First of all, you’ll have to add some categories and tags to your site. This is a header of a basic WordPress site:
There are three post categories, and we would like to add a widget for the Events category only.
To achieve it, you have to go to the administrator panel, and then move to Apperance -> Taxonomy Sidebars.
Here you can add sidebars for any taxonomies you like. The sidebar options are:
- the sidebar’s name (it is recommended to name it just like the taxonomy you want to assign it to)
- taxonomy type (basic WordPress taxonomies are post category and tag)
- two options defining the HTML structure (whether the sidebar should be a list element or a separate box)
This is an exemplary sidebar for one of the categories. Note that when you select the taxonomy type, a select box for choosing specific taxonomy will appear. When you’re ready, click “Add”, and then save the changes with a button below.
After adding the sidebar in the panel, we will also have to add it to the template file in order to make it visible.
Please login to your FTP server. As we’re adding a sidebar for a category taxonomy, we will have to edit the category.php file in the “wp-content/themes/your_theme_name/” directory.
Add this piece of code:
<?php taxonomy_sidebar(‘the_sidebar_id’); ?>
where the_sidebar_id is the ID of the sidebar you have added in the panel. So in our example, the code will be:
<?php taxonomy_sidebar(‘taxonomy_sidebars-events’); ?>
Add this code above or below the
line.
The last step is to add a widget to our new sidebar. To do it, click Appearance and move to the Widgets section.
On the right, you will see the list of all sidebars with our new Events sidebar:
To add a widget to the Events sidebar, click the sidebar to unwind it and drag&drop a widget to it:
After configuring the widget settings remember to save the widget.
Taxonomy Sidebars In Action
This is the homepage of our WordPress blog:
A standard WordPress text widget can be seen here. It appears at any page of the blog, including the homepage.
Let’s move to the Events category:
Here we can see two widgets: the standard one and the taxonomy widget we added before.
You can use this extension in the exact same way with another WordPress taxonomies – tags. Just make sure to select the “Tag” taxonomy type when adding a sidebar and to add this line:
<?php taxonomy_sidebar(‘your_sidebar_id’); ?>
to the
“wp-content/themes/your_theme_name/tag.php“
file instead of category.php.
There are many other ways of using this extension and the only limit is your imagination.
Changelog
- v1.0.1 – 2013-09-18
* Added: Activation and deactivation hooks
* Fixed: Plugin now works properly for post categories and post tags
* Fixed: Warnings after first installation - v1.0 – the first ready and stable version.