-
-
Save robneu/6843804 to your computer and use it in GitHub Desktop.
Conditionally display the full content on specific categories using the Genesis Framework.
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 | |
add_action( 'genesis_before_loop', 'prefix_full_content_specific_categories' ); | |
/** | |
* Filter the output of specific categories so that they display the full | |
* content regarldess of what's selected in the Genesis theme options panel. | |
* | |
* @author FAT Media <http://youneedfat.com> | |
* @copyright Copyright (c) 2013, FAT Media, LLC | |
* @license GPL-2.0+ | |
* @uses is_category <http://codex.wordpress.org/Function_Reference/is_category> | |
* @todo change 'prefix' to the theme prefix. | |
*/ | |
function prefix_full_content_specific_categories() { | |
$full_categories = array( 'your-category' ); | |
if ( is_category( $full_categories ) ) { | |
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