• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Using Genesis Simple Sidebars Plugin To Add New Sidebar To Custom Taxonomy Archive Page

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.

Genesis Simple Sidebars i.d

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:

Register for full access

Related Tutorials

  • 3 Ways To Add Custom Sidebars To Single Custom Post Type Pages

Custom Sidebar

Reader Interactions

Comments

  1. Bill says

    February 8, 2014 at 3:20 pm

    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.

    Log in to Reply
    • Brad Dalton says

      February 8, 2014 at 3:51 pm

      Hello Bill

      Rinse and repeat the code

      With unique i.d’s for the taxonomy and sidebar i.d

      if ( is_tax(ctt-archive) ) {
      
      genesis_widget_area( 'ctt-sidebar' )

      And unique functions names

      Log in to Reply
      • Bill says

        February 8, 2014 at 5:33 pm

        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:

        //* Add custom sidebar to custom taxonomy type archive  ex.) Used Equipment
        add_action( 'get_header', 'add_custom_tax_archive_sidebar' );
        function add_custom_tax_archive_sidebar() {
        
           if ( is_tax('equipment-type') ) {
           
            remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
            add_action( 'genesis_sidebar', 'custom_taxonomy_archive_sidebar' );
          }
        }
        function custom_taxonomy_archive_sidebar() {
        	genesis_widget_area( 'used' );  
        }
        
        
        
        //* Add custom sidebar to custom taxonomy type archive  ex.) New Equipment
        add_action( 'get_header', 'add_custom_tax_archive_sidebar1' );
        function add_custom_tax_archive_sidebar1() {
        
          if ( is_tax('equipment-type') ) {
            
            remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
            add_action( 'genesis_sidebar', 'custom_taxonomy_archive_sidebar1' );
          }
        }
        function custom_taxonomy_archive_sidebar1() {
        	genesis_widget_area( 'new' );  
        }
        
        
        //* Add custom sidebar to custom taxonomy type archive  ex.) Rebuilt Equipment
        add_action( 'get_header', 'add_custom_tax_archive_sidebar2' );
        function add_custom_tax_archive_sidebar2() {
        
          if ( is_tax('equipment-type') ) {    
            
            remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
            add_action( 'genesis_sidebar', 'custom_taxonomy_archive_sidebar2' );
          }
        }
        function custom_taxonomy_archive_sidebar2() {
        	genesis_widget_area( 'rebuilt' );  
        }
        
        But, I got a simple sidebar for each of the three taxonomies in the sidebar area
        
        so then I 
         REPLACED THIS:   
         if ( is_tax('equipment-type') ) {
            
        WITH THIS (in order to target just the one taxonomy):  
        if ( is_tax('equipment-type', 'used' ) 
        
        
        (and I did this for the other two as well with the appropriate specific taxonomy)
        if ( is_tax('equipment-type', 'new' ) 
        if ( is_tax('equipment-type', 'rebuilt' )

        I thought this would work, but I kept getting errors.

        Log in to Reply
        • Brad Dalton says

          February 8, 2014 at 5:47 pm

          if ( is_tax('equipment-type', 'new' ) 
          if ( is_tax('equipment-type', 'rebuilt' )

          This is wrong. Simply copy the process i used 3 times.

          Should be:

          if ( is_tax('taxonomy-slug' )
          Log in to Reply
  2. Herb Trevathan says

    December 7, 2013 at 8:17 pm

    Great Post : )

    Hey, do you have post showing how to reorder CPT’s in the admin panel with priorities?

    Log in to Reply
    • Brad Dalton says

      December 7, 2013 at 8:21 pm

      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.

      Log in to Reply
      • Herb Trevathan says

        December 7, 2013 at 8:35 pm

        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?

        Log in to Reply
        • Brad Dalton says

          December 7, 2013 at 8:44 pm

          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.

          Log in to Reply
        • Brad Dalton says

          December 13, 2013 at 11:23 am

          Just worked this out Herb.

          'menu_position' => 1,
          Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.