• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Different Sidebar on a CPT Archive Index Page

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Different Sidebar on a CPT Archive Index Page

This topic is: resolved

Tagged: simple sidebars

  • This topic has 5 replies, 3 voices, and was last updated 12 years, 5 months ago by Jen Baumann.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • December 21, 2012 at 3:11 pm #6743
    Lucas Hall
    Member

    How do I remove the primary sidebar from (and add another created by Genesis Simple Sidebars) a Custom Post Type Archive page?

    I've created a CPT with a "'has_archive' => true,". That page can be found here: http://landlordology.com/tips/, which is being created by a template called "archive-tips.php"

    When I try to remove the primary sidebar, and replace it with one created by the Genesis Simple Sidebar Plugin, the primary does not get removed.

    The following code isn't working: remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );

    The result is that my new sidebar (tips-sidebar) is added underneath the current primary sidebar. On the page: http://landlordology.com/tips/, the Facebook like box is the last item in the primary sidebar.

    Here is the code I'm using:

    /************************************************
    New Sidebar for Tips
    ************************************************/
    add_action('get_header','cd_change_genesis_sidebar');
    function cd_change_genesis_sidebar() {
    if ( is_post_type_archive('tips') ) { // My CPT is called tips
    remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); // remove the default genesis sidebar
    add_action( 'genesis_sidebar', 'cd_do_sidebar' ); // add an action hook to call the function for my custom sidebar
    }
    }

    //Function to output my custom sidebar
    function cd_do_sidebar() {
    dynamic_sidebar( 'tips-sidebar' ); // tips-sidebar is a widget area created by the Genesis Simple Sidebar plugin
    }

    This question was partially addressed by Ron but the solution doesn't help the CPT archive/index page:http://www.studiopress.com/support/showthread.php?p=574602


    Best,
    Lucas Hall
    http://Landlordology.com

    December 22, 2012 at 9:42 am #6941
    Jen Baumann
    Participant

    When you use Simple Sidebars, the actions change. If you open Simple Sidebars and look at the code, you'll see that the standard Genesis sidebar is already removed with the following code.

    function ss_sidebars_init() {
    remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
    remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
    add_action( 'genesis_sidebar', 'ss_do_sidebar' );
    add_action( 'genesis_sidebar_alt', 'ss_do_sidebar_alt' );
    }

    December 22, 2012 at 1:45 pm #7013
    cdils
    Participant

    Hi Lucas,

    Try creating a regular ole Page and setting it to use your archive-tips.php template. There's a dropdown box on the page where you can select which sidebar you want to use - no extra code needed. 🙂

    The code you're referencing above would be if you wanted to specify the sidebar with code alone and no template (archive-tips.php).

    Carrie


    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂

    I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.

    December 22, 2012 at 6:42 pm #7072
    Jen Baumann
    Participant

    A page template would need a custom CPT loop to work.
    http://wpsmith.net/2011/genesis/how-to-create-a-wordpress-custom-post-type-template-in-genesis/

    December 30, 2012 at 10:30 pm #8524
    Lucas Hall
    Member

    Thanks you guys!  Excellent support.  I simply removed ss_do_sidebar and it worked perfectly.


    Best,
    Lucas Hall
    http://Landlordology.com

    December 31, 2012 at 8:24 am #8591
    Jen Baumann
    Participant

    Glad to help!

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Different Sidebar on a CPT Archive Index Page’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble