Hi everyone,
I have a custom post type called Projects and I want a custom sidebar for the Projects Index page. I have created the custom sidebar and i’ve added code into the functions.php file for my child theme to add the sidebar to the CPT but its still not working. There is a space on the right where it looks like the sidebar should appear but nothing is there.
Here is the code that I used:
// =============================================================================
// Assign sidebar to custom post archives
// =============================================================================
add_filter( ‘ups_sidebar’, ‘add_cpt_sidebar’ );
function add_cpt_sidebar($sidebar){
if ( is_post_type_archive(‘project’) && ! empty( $query->query[‘post_type’] == ‘project’ )) {
return ‘ups-sidebar-project-index’;
}
return $sidebar;
}
// =============================================================================