Skip to content

Instantly share code, notes, and snippets.

@cdils
Forked from robneu/full-content-archives-genesis.php
Last active December 30, 2015 00:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdils/7748069 to your computer and use it in GitHub Desktop.
Save cdils/7748069 to your computer and use it in GitHub Desktop.
Pretty much the same as Rob's original code, but changed the conditional for a custom post type archive.
<?php
add_action( 'genesis_before_loop', 'prefix_full_content_specific_cpt' );
/**
* Filter the output of specific CPT archives so that they display the full
* content regarldess of what's selected in the Genesis theme options panel.
*
* @author FAT Media <http://youneedfat.com>, Carrie Dils <http://www.carriedils.com>
* @copyright Copyright (c) 2013, FAT Media, LLC
* @license GPL-2.0+
* @uses is_post_type_archive <http://codex.wordpress.org/Function_Reference/is_post_type_archive>
* @todo change 'prefix' to the theme prefix.
*/
function prefix_full_content_specific_cpt() {
$all_cpts = array( 'your-cpt' );
if ( is_post_type_archive( $all_cpts ) ) {
add_filter( 'genesis_pre_get_option_content_archive_thumbnail', 'prefix_no_post_image' );
add_filter( 'genesis_pre_get_option_content_archive', 'prefix_do_full_content' );
add_filter( 'genesis_pre_get_option_content_archive_limit', 'prefix_no_content_limit' );
}
}
/**
* Prevent the featured image from being loaded twice.
*
* @todo change 'prefix' to the theme prefix.
*/
function prefix_no_post_image() {
return '0';
}
/**
* Set the content archives to full.
*
* @todo change 'prefix' to the theme prefix.
*/
function prefix_do_full_content() {
return 'full';
}
/**
* Make sure the content limit isn't set.
*
* @todo change 'prefix' to the theme prefix.
*/
function prefix_no_content_limit() {
return '0';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment