Skip to content

Instantly share code, notes, and snippets.

@ThierryA
Last active March 23, 2016 07:27
Show Gist options
  • Save ThierryA/df85cf8ac38a3665951e to your computer and use it in GitHub Desktop.
Save ThierryA/df85cf8ac38a3665951e to your computer and use it in GitHub Desktop.
Beans: display posts in a responsive grid.
<?php
// Do not include the opening php tag if it is already included in your file.
// Display posts in a responsive grid.
add_action( 'wp', 'beans_child_posts_grid' );
function beans_child_posts_grid() {
// Stop here if we are on a singular view.
if ( is_singular() )
return;
// Add grid.
beans_wrap_inner_markup( 'beans_content', 'beans_child_posts_grid', 'div', array(
'class' => 'uk-grid uk-grid-match',
'data-uk-grid-margin' => ''
) );
beans_wrap_markup( 'beans_post', 'beans_child_post_grid_column', 'div', array(
'class' => 'uk-width-large-1-3 uk-width-medium-1-2'
) );
// Move the posts pagination after the new grid markup.
beans_modify_action_hook( 'beans_posts_pagination', 'beans_child_posts_grid_after_markup' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment