Site logo

Archived topic

Hide sidebar widget from index page

16 replies · Started by Petar on March 14, 2022

Viewing posts 1–15 of 17

Hello, is it possible to hide the sidebar widget only from desired pages? Index in this case. I had some plugins for that before but it is not compatible with the latest PHP version.

thanks

Hi Petar,

Yes, this is possible. To confirm, do you want to remove the entire sidebar or just a Sidebar widget?

If you want to hide the entire sidebar for certain Pages, you may use a Layout Element.

Here is an article with regards on how to use it: https://docs.generatepress.com/article/layout-element-overview/

Otherwise, if you want to remove a sidebar widget, might I suggest that you add this Sidebar widget as a Block or Hook Element. Through this, you’ll be able to select which pages would have this widget and which ones wouldn’t through the Display rules.

For instance: https://share.getcloudapp.com/QwuLe755

Also see: https://share.getcloudapp.com/d5u9z0Rp

This might also help: https://www.youtube.com/watch?v=1E7zFl678kg

Hope this clarifies. :)

I am unable to do it. Maybe because I am using classic widgets and classic editor?

I see. Which specific functionality are you referring to? You would need to use the current WordPress default Gutenberg Block Editor to use a Block Element.

Otherwise, you’ll need custom CSS code to hide certain sidebar widgets for certain pages.

Hope this clarifies. Kindly let us know. :)

It is behind my knowledge. Is there some simple plugin like it was Advanced Tex Widget, that you are recommending? That one gave the simple dropdown menu below the widget where I could choose where the widget will be shown. Unfortunately,it doesn't work with the latest Php version

What version of WordPress are you using? The Gutenberg Block Editor has been the default WordPress editor since version 5.0.

If you’re using a plugin to revert the editor to the Classic editor, you’ll need to disable this to have access to more of our functionalities. I would suggest trying this first. :)

I’m not aware of a plugin that has this functionality but if you prefer not to use the default Block Editor maybe you could link me to a page where this specific widget is visible and I’ll try to see if I can give a code to your preference.

Hope to hear from you soon. :)

thanks. I am sending you detailed info in private information

If by index page, you mean the Blog archive page which is your Homepage, here is a CSS code you may try to remove that specific widget:

.blog aside#recent-posts-widget-with-thumbnails-2 {
    display:none;   
}

Here is an article with regards to adding CSS: https://docs.generatepress.com/article/adding-css/#additional-css

Adding it through additional CSS should work.

Kindly let us know how it goes. :)

editing child theme helped. thanks

You’re welcome Petar! Glad to be of assistance! Feel free to reach out anytime if you’ll need assistance with anything else. :)

marking this as resolved

hm...problem appeared again. Code is still there in: GeneratePress Child: Stylesheet (style.css)

I am adding site here to avoid similar or duplicate posts. Ok?

Yes, that would be fine Petar!

Can you try this CSS instead?:

.blog aside.recent-posts-widget-with-thumbnails {
    display:none;   
}

This would remove any recent post widget that has a thumbnail in your blog page.

Kindly let us know how it goes. :)

This archived topic is closed to new replies.