In this post, we’ll look at adding a custom sidebar to a custom taxonomy archive page.
This post assumes you have added a custom post type to your theme which supports creating custom taxonomy archive pages.
A custom taxonomy archive page is like a category archive page for your custom post type.
Remove Full Width Layout Code From Archive Template
The first step is to open your taxonomy-portfolio-type.php file and remove this line of PHP code which forces a full width layout on custom taxonomy archive pages:
//* Force full width content layout
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
If you don’t remove this code, you cannot display a sidebar on your archive.
Create Custom Sidebar
The 2nd step is to create a custom sidebar using the Genesis Simple Sidebars plugin.
In this example, i have created a sidebar using the i.d ctt-sidebar.
Here’s the line of code from the below snippet which needs to include the custom sidebar i.d which in this case is ctt-sidebar:
Hi Brad,
Thank you! Your articles are very informative and your name keeps coming up in the SE’s for all kinds of genesis mods. It’s very helpful.
I would like to accomplish a unique sidebar for this purpose, This works great for one sidebar, however instead of just one taxonomy, how would I change the code so there is a conditional for say three different taxonomies of a CPT… in the case that you want a different sidebar in each of the three taxonomies?
In my example, the CPT is called ENGINES
and I have three taxonomies for it: NEW, USED, & REBUILT
I tried coming up with a conditional to fire off a different simple sidebar for each of the three taxonomies, but I failed.
Hello Bill
Rinse and repeat the code
With unique i.d’s for the taxonomy and sidebar i.d
And unique functions names
Thanks for the fast reply Brad….
that is what I tried originally before posting in the comments, but I clearly am doing something wrong.
I tried this first:
I thought this would work, but I kept getting errors.
This is wrong. Simply copy the process i used 3 times.
Should be:
Great Post : )
Hey, do you have post showing how to reorder CPT’s in the admin panel with priorities?
Hey Herb,
Don’t think so but you can add query sets to-reorder on the archive page.
Not sure i understand the question properly.
sorry, kinda tired today – like if I have CPT’s added with different names like portfolio, and then another added CPT named projects, is there a way to re order those and control which one is on top in the admin sidebar?
Here’s an easy solution http://wordpress.org/plugins/admin-menu-editor/
You probably wanted code which i don’t have at the moment however i think you should be able to add a parameter in the action which controls this. Never done this before but will give it a go once i get my new computer. On someone else’s at the moment as my Dell has crashed and is beeping without the screen working.
Just worked this out Herb.