• I am trying to add category sidebars to the category pages but this theme doesn’t use categories even if I add a function it ignores the categories. The sidebars function for creating category sidebars works however I can only ever select two types in your page template.
    This is the function for the sidebars:

    function category_sidebars() {
    	$categories = get_categories( array( 'hide_empty'=> 0 ) );
    
    	foreach ( $categories as $category ) {
    		if ( 0 == $category->parent )
    			register_sidebar( array(
    				'name' => $category->cat_name,
    				'id' => $category->category_nicename . '-sidebar',
    				'description' => 'This is the ' . $category->cat_name . ' widgetized area',
    				'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    				'after_widget' => '</aside>',
    				'before_title' => '<h3 class="widget-title">',
    				'after_title' => '</h3>',
    			) );
    	}
    }

    I select a page and those sidebars never show up. So what I am trying to achieve is this – category one on the page show this category one sidebar and then on the single page that category one sidebar is showing so that it is easy for the viewer to sift through category articles.

    Thanks

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter nanny7

    (@nanny7)

    Forgot to say I even included a category template in my child theme but it is ignored.

    hannah

    (@hannahritner)

    Hi nanny7,
    Hope I’m following you correctly. You can create multiple sidebars from Theme Options > Misc Settings and add content from Appearance > Widgets. Then you can assign a sidebar to a specific page from the edit page. Does that work for you?

    Hannah

    Thread Starter nanny7

    (@nanny7)

    I can create multiple sidebars but in a post or page it only allows me to select primary or news. That is why I opted to use divi builder so I can add any sidebar I want to.
    Thanks

    hannah

    (@hannahritner)

    I just tested this and I was able to select from any sidebar on my edit page. Have you cleared your cache after adding the sidebars? Also be sure that you’ve added content to them from Appearance > Widgets.

    Hannah

    Thread Starter nanny7

    (@nanny7)

    Yes I can create them but I can’t select them only primary or news shows in the dropdown select and yes cache cleared this has been going on since first time using. It doesn’t matter how many sidebars I create when you add a post there is only those two every time.

    Hope that makes sense.

    thanks for your help.

    Hey,
    So to get more than two you have to add the sidebars through the theme options > misc settings.

    That dropdown doesn’t look for any widget areas created on the site it’s just looking for sidebars created through the theme options > misc settings.

    Since you seem to be using a function to create sidebars and not going through the theme options it’s not being registered for the dropdown in pages and posts.

    I hope that clarifies.

    Ben

    Kadence Themes

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Custom Single Side Bar not working’ is closed to new replies.