Last active
April 14, 2020 07:27
-
-
Save generatepress/9fe7ed28e64ced5ef40d to your computer and use it in GitHub Desktop.
Change the sidebar widths depending on page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'generate_right_sidebar_width','generate_right_sidebar_width_custom', 50 ); | |
function generate_right_sidebar_width_custom() | |
{ | |
if ( is_page( 'page-slug' ) ) { | |
return '20'; // 20% for yourURL.com/page-slug | |
} | |
if ( is_page( 'another-slug' ) ) { | |
return '30'; // 30% for yourURL.com/another-slug | |
} | |
// If neither of the above are true, return your default value | |
return '25'; // 25% or whatever your default is | |
} | |
add_filter( 'generate_left_sidebar_width','generate_left_sidebar_width_custom', 50 ); | |
function generate_left_sidebar_width_custom() | |
{ | |
if ( is_page( 'custom-slug' ) ) { | |
return '50'; // 50% for yourURL.com/custom-slug | |
} | |
if ( is_page( 'one-more-slug' ) ) { | |
return '15'; // 15% for yourURL.com/one-more-slug | |
} | |
// If neither of the above are true, return your default value | |
return '25'; // 25% or whatever your default is | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment