- This topic has 7 replies, 5 voices, and was last updated 5 years, 11 months ago by
Tom.
-
AuthorPosts
-
April 30, 2018 at 6:53 am #563701
Kevyn
Hello,
I would like to add a sidebar on a specific page while using sections.
I see I have to add the PHP code: add_filter( ‘generate_sections_sidebars’,’__return_true’ );
I installed the Code Snippets plugin and almost done installing a Child Theme.
However, I do not understand where do I have to copy-paste this PHP code?
Thank you!
KevynApril 30, 2018 at 7:47 am #563756Leo
StaffCustomer SupportHi there,
It would be in the child theme’s function.php file.
April 23, 2020 at 2:36 am #1250752Yurik
I would like to add a sidebar on a specific page while using sections PHP code: add_filter( ‘generate_sections_sidebars’,’__return_true’ );
if it not a Child theme, where do I have to copy-paste this PHP code? Please help
Thank you!
YurikApril 23, 2020 at 4:27 am #1250969David
StaffCustomer SupportHi there,
if you’re not using a Child Theme you can use the Code Snippets plugin:
April 23, 2020 at 4:49 am #1251002Yurik
Hi David, thanks for quick reply!
I have tried with Code Snippets, by adding new and pasting the php code as it is, but it not working on my site. Maybe I’ve missed something and need to write any function a part?
Please can you show me any example, or create and clone one so I could try?Many thanks!
April 23, 2020 at 5:54 am #1251118David
StaffCustomer SupportI replied to your Topic here
April 23, 2020 at 6:15 am #1251175Yurik
Hi David,
thanks agin for reply! Unfortunately this is still not working for me.
I have sidebars ON in layouts and snippets is enabled on whole site, but in the url im tryin to enable the section the sidebar not appears.Please check this out here, where I’m have page with sections enabled: https://spainru.com/biznes-v-ispanii/
The Sidebar Layout is active and setup to show “Content/Sidebar” (basically I have this conf. by default, same for all sites & posts. Main page and all other have sidebar visible.
Examples
Layout conf – https://imgur.com/a/ev4WkDu and https://imgur.com/a/VDYRs2x
Snippet conf – https://imgur.com/a/ZyjPFxd
I’m really lost and not sure where is the fix. What else I could do to make it work?
Many thanks!
April 23, 2020 at 4:25 pm #1252324Tom
Lead DeveloperLead DeveloperYou may need the code to fire later. Try this:
add_action( 'wp', function() { add_filter( 'generate_sections_sidebars', '__return_true' ); } ); -
AuthorPosts
- You must be logged in to reply to this topic.