Dynamic Sidebars for Custom Post Type
Hi, I need to add different sidebars for a custom post type archive and single page. I don't see the custom post type listed in the drop-down for selecting groups in Dynamic sidebar extension. Is there any hook available for adding archive and single page of the Custom post type in the drop-down?
All post types registered with 'public' => true should appear in the drop-down.
Also you can use the fw_ext_sidebars_post_types filter to add other post types in drop-down.
@player0k , Thanks for your reply. However, it allows me to assign different sidebars to only single page of custom post type. For archive of custom post type, it takes the setting from 'Archive Page' option in the drop-down. How do I assign different sidebars for different custom post type archives?
@ankitaraikundalia,
The filter: 'fw_ext_sidebars_conditional_tags' was added in the last update of Unyson-Sidebars-Extension. It is available in the Unyson plugin version Use it to change conditional tags.
function _filter_fw_ext_sidebars_add_conditional_tag($data) {
$data['is_archive_page_slug'] = array(
'order_option' => 2, // (optional: default is 1) position in the 'Others' lists in backend
'check_priority' => 'last', // (optional: default is last, can be changed to 'first') use it to change priority checking conditional tag
'name' => __('Portfolio archive', 'fw'), //conditional tag title
'conditional_tag' => array(
'callback' => 'is_post_type_archive', //existing callback
'params' => array('fw-portfolio') //parameters for callback
)
);
return $data;
}
add_filter('fw_ext_sidebars_conditional_tags', '_filter_fw_ext_sidebars_add_conditional_tag' );
@player0k I added the above code in hooks.php, but nothing happened.
@ankitaraikundalia,
Thanks, the code in the message above was changed. There were some mistakes.
@player0k , The code still doesn't work even after the change.
@player0k - Any progress on this issue?
@ankitaraikundalia, Sorry, but we can't reproduce this bug. http://screencast.com/t/CW3SDjZ5jOYX Could you please provide additional information about this issue.
@player0k
I added the code in inc/hooks.php, but I can't see Portfolio Archive option in the dropdown.
Below is the screenshot:

@ankitaraikundalia, Create the empty file in the your_current_theme_directory/framework-customizations/extensions/sidebars/hooks.php and put that code there. Also check if installation https://github.com/ThemeFuse/Theme-Includes was completed according to install instructions.
@player0k I added the code in theme_directory/framework-customizations/extensions/sidebars/hooks.php I also checked the install instructions and it was done in the same way.
I also checked the code using Scratch theme [https://github.com/ThemeFuse/Scratch-Theme], but it doesn't work.
@ankitaraikundalia, Make sure that you have last update of https://github.com/ThemeFuse/Unyson-Sidebars-Extension. The line with a filter.
@player0k The problem is that I have v1.0.0 and filter code is missing in it. But the update of extension is not seen in Unyson Extensions Update in the backend, the reason why I don't have the updated version.
Check out the below screenshot:

Also check out the manifest file of sidebars extension here. It shows the version to be 1.0.0 instead of 1.0.1
But the update of extension is not seen in Unyson Extensions Update in the backend
Because the v1.0.1 was created as a simple tag, not as a release.
Fixed. Please check the updates page.
@moldcraft Its working fine now after the update. Thank you.