Skip to content

Instantly share code, notes, and snippets.

@GaryJones
Created December 24, 2011 22:24
Show Gist options
  • Save GaryJones/1518465 to your computer and use it in GitHub Desktop.
Save GaryJones/1518465 to your computer and use it in GitHub Desktop.
Add new option to Genesis Content Archives display dropdown, and amend the toggles config to also show the Limit setting if the new value is chosen. Requires Genesis 1.8.0 to work, since neither filter existed until then.
<?php
add_filter( 'genesis_archive_display_options', 'child_add_content_archive_display_option' );
/**
* Adds new option to display type in Genesis Theme Settings Content Archives
* box.
*
* @param array $options Existing display types.
* @return array Amended display types.
*/
function child_add_content_archive_display_option( array $options ) {
$options['contentplus'] = __( 'Display 1 full post then limited content', 'child-domain' );
return $options;
}
add_filter( 'genesis_toggles', 'child_amend_toggles' );
/**
* Filter one value in the existing list of Genesis toggle settings.
*
* Works by casting the check_value from a string to an array, and merging the new
* value with the old one(s). This allows other plugins or theme code to play nicely too.
*
* @param array $toggles Existing array of toggle settings.
* @return array Amended toggle settings.
*/
function child_amend_toggles( array $toggles ) {
$toggles['content_archive'][2] = array_merge( (array) $toggles['content_archive'][2], array( 'contentplus' ) );
return $toggles;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment