Created
January 19, 2013 14:06
-
-
Save billerickson/4572826 to your computer and use it in GitHub Desktop.
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 | |
| /** | |
| * Template Name: Category Listing | |
| * | |
| * @package BE_Genesis_Child | |
| * @since 1.0.0 | |
| * @link https://github.com/billerickson/BE-Genesis-Child | |
| * @author Bill Erickson <[email protected]> | |
| * @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
Wow, thanks for the great response Bill! Below is the template I'm working with. I added the 'meta_value' line in the beginning to "hard code" the value into copies of the original portfolio-template.php, but this isn't very flexible.
It appears that lines 25-26 are most relavent. I'll try adding that in, but thought seeing the actual template I'm working on might be helpful
Question, outside of good coding practice, what would be the benefit of the post meta field validation?
Sorry if I didn't mention this isn't a Genesis flavored theme, it's my first time venturing out of the Genesis community! And I don't know if I'll do that again.