Site logo

Archived topic

Select sidebar widget in chosen page

3 replies · Started by Daniele on February 15, 2021

Viewing posts 1–4 of 4

I saw that there is the possibility to enable / disable some widgets in the footer, but is it possible to do this for the sidebar too?

Thanks
Daniele

Hi Daniele,

Yes, for example if you want to hide a widget in sidebar on home page, you could try this CSS:

.home #right-sidebar .the-widget-css-class{
    display: none
}

Thanks Ying, you are very nice and kind. Now, however, I need a code to open a widget only in one page.. Is it possible?

Thanks,
Daniele

Hi there,

Thanks Ying, you are very nice and kind. Now, however, I need a code to open a widget only in one page.. Is it possible?

It's definitely possible with CSS as well.

WordPress adds in page ID to its body tag. That said, you can do something like this:

Example:

body.page-id-1674 #right-sidebar .the-widget-css-class{
    display: block;
}

Just change 1674 in body.page-id-1674 with the page-id you want the CSS to be applied.

This archived topic is closed to new replies.