This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Widget Area Assignments for Custom Post Types

  • Creator
  • #855

    Is there support for Widget Area Assignments for Custom Post Types? Currently when you add/edit a new widget area, any custom post types created are not in the list anywhere. Here is how I would like to use it:

    1) Select “Left Sidebar” and check a box for my custom post type (archive and/or single)
    2) Create a “Flowing Widget Area” and assign it in the template with code or a filter. If this is possible, please provide a code example so I can follow it. I have full access to FTP and template files so I can edit accordingly. I just need some direction.


Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #864
    Jason Bobich


    Unfortunately this is currently not possible, although will be in the next round of theme updates. This doesn’t really help you now, but in the next update you’ll be able to accomplish this actually in several ways.

    Since I hate the fact that I have to tell you this is a feature I’ve built in for the future but you can’t use it yet, I’ll try to provide you with a solution. Currently, I believe the only way would be to actually filter in the sidebar yourself from your Child theme’s functions.php.

    Here’s an example:

    function my_custom_sidebar( $config ){
    	$post_type = 'your_post_type';
    	$sidebar_id = 'your_sidebar_id';
    	if( $post_type == get_post_type() ) {
    		// Determine if sidebar has widgets
    		$error = false;
    		if( ! is_active_sidebar( $sidebar_id ) )
    			$error = true;
    		// Adjust config	
    		$config['sidebars']['sidebar_right'] = array(
    			'id' => $sidebar_id,
    			'error' => $error
    	return $config;
    add_filter( 'themeblvd_frontend_config', 'my_custom_sidebar' );

    Just change the $post_type and $sidebar_id variables to fit what you’re doing. Also note that this would be specifically for the “sidebar_right” location, and the “location” that you’ve selected in the Widget Area Manager for whatever custom sidebar ID in your WP admin is irrelevant in this case.


    This is great. It’s just what I need. Thank you for taking the time to send the code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The forum ‘Barely Corporate Responsive WordPress Theme’ is closed to new topics and replies.