Last active
January 10, 2016 15:00
-
-
Save simbasounds/8a23c1fd588bc6583641 to your computer and use it in GitHub Desktop.
A portfolio CPT page loop for the Genesis Framework
(based on http://designsbynickthegeek.com/tutorials/creating-page-templates-in-genesis)
This file contains 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 | |
add_action('genesis_after_header','portfolio_title'); | |
function portfolio_title() { ?> | |
<div class="portfolio-title"> | |
<div class="wrap"> | |
<h1 class="entry-title" itemprop="headline"> | |
<span class="portfolio-headline">Portfolio » </span> | |
<?php the_title(); ?> | |
</h1> | |
</div> | |
</div> | |
<?php } | |
add_action('genesis_entry_content', 'post_thumbnail'); | |
function post_thumbnail() { | |
if ( has_post_thumbnail() ) { ?> | |
<a href="<?php echo get_page_link(); ?>" title="<?php echo get_the_title(); ?>"><?php the_post_thumbnail( $size, $attr ); ?></a> | |
<?php } | |
} | |
remove_action( 'genesis_loop', 'genesis_do_loop' ); | |
add_action( 'genesis_loop', 'portfolio_do_loop' ); | |
function portfolio_do_loop() { | |
$include = get_post_meta(get_the_id(), 'Portfolio Category', true); | |
global $paged; | |
$query_args = wp_parse_args( | |
genesis_get_custom_field( 'query_args' ), | |
array( | |
'cat' => $include, | |
'showposts' => genesis_get_option( 'blog_cat_num' ), | |
'paged' => $paged, | |
'post_type' => array( 'portfolio' ), | |
) | |
); | |
genesis_custom_loop( $query_args ); | |
} | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment