Need help with sidebars

Hi. Using Xpro, fullwidth layout with pages using sidebars. I am trying to add a sidebar for my BadgeOS plugin widgets. I have a sidebar established and do see the pages listed on the sidebar and have checked them off (screenshot 1). The widgets do appear on my page here https://mysalus.org/community/awards-gallery.

They do not however show up on the next level uri’s /active-learner/ etc. I am also using the Extended Widget Options widget and have checked the relevant pages and posts that show there (screenshot 2). I also tried placing the Badge OS widgets in the main sidebar but that did not work either.

I assume the BadgeOS plugin is using custom post types and have read and tried these posst for guidance https://theme.co/apex/forums/topic/assign-sidebar-to-custom-post-type/ but adding code to my child functions.php , referencing the “types” in the BadgeOS shortcode crashes the page the shortcodes “types” are on. Here is the code I tried using the above reference article.

// 03. Add BadgesOS CPT Sidebar
// =============================================================================

function add_sidebar_custom_post() {
if( get_post_type() == ‘community-badge’) {
return ‘ups-sidebar-badges’;
} elseif get_post_type() == ‘personal-badge’) {
return ‘ups-sidebar-badges’;
} elseif get_post_type() == ‘achievement’) {
return ‘ups-sidebar-badges’;
}
}
add_filter( ‘ups_sidebar’, ‘add_sidebar_custom_post’ );

I also read and tried the suggested solution here and https://theme.co/apex/forum/t/sidebars-not-appearing/2323 and have it currently in my functions.php. But that did not solve the problem either.

Thought I would see if there is something simple I am missing or if others have tried this?

Thanks in advance

Hi There,

Please also add this code to the functions.php file locates in your child theme:

function x_get_content_layout() {

    $content_layout = x_get_option( 'x_layout_content' );

    if ( $content_layout != 'full-width' ) {
      if ( is_home() ) {
        $opt    = x_get_option( 'x_blog_layout' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_singular( 'post' ) ) {
        $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
        $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
      } elseif ( x_is_portfolio_item() ) {
        $layout = 'full-width';
      } elseif ( x_is_portfolio() ) {
        $meta   = get_post_meta( get_the_ID(), '_x_portfolio_layout', true );
        $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta;
      } elseif ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
        $layout = 'content-sidebar';
      } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
        $layout = 'sidebar-content';
      } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
        $layout = 'full-width';
      } elseif ( is_archive() ) {
        if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
          $opt    = x_get_option( 'x_woocommerce_shop_layout_content' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        } else {
          $opt    = x_get_option( 'x_archive_layout' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        }
      } elseif ( x_is_product() ) {
        $layout = 'full-width';
      } elseif ( x_is_bbpress() ) {
        $opt    = x_get_option( 'x_bbpress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( x_is_buddypress() ) {
        $opt    = x_get_option( 'x_buddypress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_404() ) {
        $layout = 'full-width';
      } else {
        $layout = $content_layout;
      }
    } else {
      $layout = $content_layout;
    }

    if ( is_singular( array('community-badge', 'personal-badge', 'achievement') ) ) {
        $layout = 'content-sidebar';
      }

    return $layout;

}

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.