Skip to content

Instantly share code, notes, and snippets.

@robneu
Forked from srikat/functions.php
Last active December 24, 2015 18:29
Show Gist options
  • Save robneu/6843804 to your computer and use it in GitHub Desktop.
Save robneu/6843804 to your computer and use it in GitHub Desktop.
Conditionally display the full content on specific categories using the Genesis Framework.
<?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