Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimcoleman/b070386b83451f95b64b6649c4c6bb26 to your computer and use it in GitHub Desktop.
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.
<?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