Archived topic
Display widgets only in the homepage
11 replies · Started by Abdul on September 8, 2021
I want to display my left panel widgets only on the homepage and not show them on the individual posts page.
can you please let me know how to do it?
I don't want these to be displayed on all the individual posts page
Subscribe to our blog
Search
Categories
Hi there,
I believe this is what you are after:
https://docs.generatepress.com/article/sidebar-layout/#single-post-sidebar-layout
Let me know if this helps :)
Thanks Leo, that helps.
can you please let me know where to add this code so that I can remove the default widgets but also keep the sidebar area
https://docs.generatepress.com/article/generate_show_default_sidebar_widgets/
This code
add_filter( 'generate_show_default_sidebar_widgets', '__return_false' );
Checkout the Adding PHP article shown at the bottom of the article :)
added the code using the code snippets plugin but it is not reflecting in the post pages
Can you clear and disable your caching plugin first?
https://www.screencast.com/t/LVj6k1PLjp
Also, are you simply trying to make single posts container narrower?
If so a layout element would be the best solution:
https://docs.generatepress.com/article/layout-element-overview/#content-1
Want to keep the right sidebar empty to show display ads
How are you going to add the ads?
I will be adding using code snippets
Is it going to be using a hook?
Yes, I figured it out. I will add them as a hook.
Thanks for your help
No problem :)