Add Column Classes To Genesis Custom Loop

The code in this tutorial creates a custom loop which enables you to use any WP_Query parameters. On top of this, it enables you to include Bootstrap column classes so you can display any post type entries in columns.

genesis-custom-loop-with-column-classes

You can also remove default functions attached to a specific action hook from the standard loop enabling you to customize the output of each entry in your custom loop.

To remove standard functions from each entry, simply add any remove_action hooks to line 25 in the template code.

Some examples of standard functions you can remove from each entry in your custom loop:

//* Remove the post info function
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );

//* Remove the post image (requires HTML5 theme support)
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );

//* Remove the entry title (requires HTML5 theme support)
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    
//* Remove the post meta function
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );

The template also includes pagination.

Template Installation

  1. Create a new file named genesis-custom-loop.php in your child themes root directory and add the template code below.
  2. Select the template named Columns Loop from the Template drop down menu in the Page Attributes meta box on the Edit Page screen.
  3. Adjust the column classes to your own requirements.

Here’s the template for logged in members:

Related Tutorials

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.