Created
January 31, 2024 13:00
-
-
Save kimcoleman/b070386b83451f95b64b6649c4c6bb26 to your computer and use it in GitHub Desktop.
Add a sidebar to the Memberlite blog and archives pages when using the grid-style post layout.
This file contains hidden or 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
<?php | |
function memberlite_modify_columns_ratio_for_blog( $r, $location ) { | |
// Check if the current page is a blog page | |
$maybe_add_sidebar = memberlite_is_blog(); | |
if ( $maybe_add_sidebar && ! in_array( $location, array( 'header-right', 'header-left' ) ) ) { | |
// Set layout ratio for the blog main area and sidebar | |
$r = ( $location == 'sidebar' ) ? '4' : '8'; | |
} | |
return $r; | |
} | |
add_filter( 'memberlite_columns_ratio', 'memberlite_modify_columns_ratio_for_blog', 15, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment