Sidebar Issue with Layout Builder

Hello,

I have an issue with a sidebar not showing in a Custom Post Type built with Layout Builder.
I am using Pro theme with Integrity stack and Wordpress version 5.9.1

The sidebar is not showing whatsoever: I looked for plugin conflict, updated everything, and read some other threads about this issue. Unfortunately nothing works.

I also tried to edit the theme php file with the documented code:

add_filter( ‘ups_sidebar’, ‘assign_sidebars’ );

function assign_sidebars($sidebar){
if(is_woocommerce()){
return ‘ups-sidebar-about-sidebar’;
}
return $sidebar;
}

But it does not work.
What can I do please?
Thank you in advance

Hi Eugenio,

Thanks for reaching out.
Not sure what exactly you are trying to do. It seems that you want to show the sidebar in the Custom Post Type layout for the Single Page. If that is the case, I would suggest you use any of the predefined templates that is having the sidebar. If you are using the Archive template, you need to create two column structures and use the Widget Area element to create a sidebar.
If that is not the case and you are trying to point out something else, please provide any screenshot marked with the issue or any video that helps us to recognize the problem.

Thanks

Sorry for the late response.

We have a Custom Post Type made with “CPT UI” plugin named corso.
The course CPT is build with xTheme’s LayoutBuilder.
The layout is “Single” and super simple:

The condition is the following:

Theme options:
image

And layout options: (now i expect that the page i made with content on the left and a sidebar on the right)
image

Then i have a sidebar:

I made a child theme and, following your documentation, i inserted this function in function.php to show the sidebar on the corso post type:

add_filter( 'ups_sidebar', 'assign_sidebars' );

function assign_sidebars($sidebar){
   if(0<10){    
      return 'ups-sidebar-corso_sidebar';
   }
   return $sidebar;
}

But nothing happens. If i create an “Archive” type layout, and all the rest is the same, the sidebar shows up, if i delete the php the sidebar disappear, as expected.

Now, what can i do to show the sidebar in the Single type layout?

We don’t want to add an widget, as it isn’t a sidebar.

Hey Eugenio,

If you are using Layout Builder, the sidebar default sidebar functionality will not work because Layout Builder has different templating. To add a sidebar using the Layout Builder, please follow the suggestion given by my colleague by creating a section for the sidebar and adding the widget so that it will act as a sidebar.

Hope that helps.

Hi @marc_a, but in this case what is the meaning of the “Content layout” options (screen below)?
image

Hello Eugenio,

You can have 3 layout options for the content of your website, Content Left - Sidebar Right, Content Right - Sidebar Left, and Fullwidth, which determines if you want to have a sidebar for your website or not.

Thanks

Hello @prakash_s, can you read the entire conversation please, not only the last response?

Hi Eugenio,

The Content Layout options are applied to the Default pages or posts. For the Layouts it is not applicable as the layout will override the default structure through it.

Thanks

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