Site logo

Archived topic

generate_right_sidebar_width

3 replies · Started by Randy on December 13, 2020

Viewing posts 1–4 of 4

For filters such as generate_right_sidebar_width, can I use the GP Premium Elements module to add these Hooks? And if so, which Hook do you apply it to and do you check the "Execute PHP" box?

add_filter( 'generate_right_sidebar_width', function() {
return 0;
} );

Would the above hide the right sidebar? Can't get this to work.

Cool, good to know. Wish you guys also made a Code Snippets tool and/or added similar functionality to your GP Premium. Great products you have!

In case it helps anyone else looking to do this, I used the Code Snippets plugin to hide the sidebar on static pages if the url parameter &myparam=myvalue is set:

add_filter( 'generate_sidebar_layout', function( $layout ) {
	$var = $_GET["myparam"];
	if (
		$var === "myvalue"
		&&
		is_page()
	) {
		return 'no-sidebar';
	}
	return $layout;
} );

Awesome, thanks for sharing the code! :)

This archived topic is closed to new replies.