Skip to content

Instantly share code, notes, and snippets.

@renventura
Last active November 16, 2018 06:34
Show Gist options
  • Save renventura/ec66f70cfd584c8937d1 to your computer and use it in GitHub Desktop.
Save renventura/ec66f70cfd584c8937d1 to your computer and use it in GitHub Desktop.
Remove content excerpt from custom post type archive in Genesis
<?php //* Mind this opening php tag
/**
* EngageWP.com
* Remove content excerpt from custom post type archive in Genesis
*/
//* Grab the content for each custom post type
add_action( 'genesis_before_loop', 'rv_cpt_excerpts' );
function rv_cpt_excerpts() {
// Set the custom post types to check
$post_types = array( 'product' );
// If the archive is an archive of one of those custom post types
if ( is_post_type_archive( $post_types ) ) {
add_filter( 'genesis_pre_get_option_content_archive_limit', 'rv_downloads_excerpt_length' );
}
}
// Set content limit to 1 character (setting it to 0 displays the entire post)
function rv_downloads_excerpt_length() {
return '1';
}
//* Modify the read more link to remove the "..."
add_filter( 'get_the_content_more_link', 'rv_read_more_link' );
function rv_read_more_link() {
if ( is_post_type_archive( 'product' ) ) {
return '<a class="more-link" href="' . get_permalink() . '">View Product</a>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment