Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
Forked from billerickson/template-listing.php
Created October 15, 2013 06:06
Show Gist options
  • Select an option

  • Save jamiemitchell/6987206 to your computer and use it in GitHub Desktop.

Select an option

Save jamiemitchell/6987206 to your computer and use it in GitHub Desktop.
<?php
/**
* Template Name: Category Listing
*
* @package BE_Genesis_Child
* @since 1.0.0
* @link https://github.com/billerickson/BE-Genesis-Child
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*
*/
/**
* Category Listing Loop
*
*/
function be_category_listing_loop() {
global $post;
$args = array(
'post_type' => 'my_cpt',
'tax_query' => array(
array(
'taxonomy' => 'cpt_category',
'fields' => 'slug',
'terms' => esc_attr( get_post_meta( $post->ID, 'be_category_listing', true ) ),
)
)
);
genesis_custom_loop( $args );
}
add_action( 'genesis_loop', 'be_category_listing_loop' );
remove_action( 'genesis_loop', 'genesis_do_loop' );
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment