Created
August 10, 2013 16:19
-
-
Save cdils/6201034 to your computer and use it in GitHub Desktop.
Register and display Portfolio CPT
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 | |
/** | |
* The custom portfolio post type archive template | |
*/ | |
/** Force full width content layout */ | |
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); | |
/** Remove the post info function */ | |
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); | |
/** Remove the post content */ | |
remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); | |
/** Remove the post image */ | |
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 ); | |
/** Remove the post title */ | |
remove_action('genesis_entry_header', 'genesis_do_post_title'); | |
/** Add the featured image after post title */ | |
add_action( 'genesis_entry_header', 'mp_portfolio_grid' ); | |
function mp_portfolio_grid() { | |
if ( has_post_thumbnail() ){ | |
echo '<div class="portfolio-featured-image">'; | |
echo '<a href="' . get_permalink() .'" title="' . the_title_attribute( 'echo=0' ) . '">'; | |
echo get_the_post_thumbnail($thumbnail->ID, 'portfolio' ); | |
echo '</a>'; | |
echo '</div>'; | |
} | |
} | |
/** Remove the post meta function */ | |
remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); | |
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
/** | |
* Register Custom post types | |
*/ | |
add_action( 'init', 'cd_post_type' ); | |
function cd_post_type() { | |
// Portfolio custom post type | |
register_post_type( 'portfolio', | |
array( | |
'labels' => array( | |
'name' => __( 'Portfolio' ), | |
'singular_name' => __( 'Portfolio' ), | |
), | |
'has_archive' => true, | |
'public' => true, | |
'rewrite' => array( 'slug' => 'portfolio' ), | |
'supports' => array( 'title', 'editor', 'genesis-seo', 'thumbnail' ), | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment