Site logo

Archived topic

Allow Sidebars with Sections

7 replies · Started by Kevyn on April 30, 2018

Viewing posts 1–8 of 8

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!
Kevyn

Hi there,

It would be in the child theme's function.php file.

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!
Yurik

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!

Snippets capture

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!

You may need the code to fire later. Try this:

add_action( 'wp', function() {
    add_filter( 'generate_sections_sidebars', '__return_true' );
} );
This archived topic is closed to new replies.