Skip to content

Instantly share code, notes, and snippets.

@rfmeier
Created January 8, 2016 21:45
Show Gist options
  • Select an option

  • Save rfmeier/dc0d950b1534445893fa to your computer and use it in GitHub Desktop.

Select an option

Save rfmeier/dc0d950b1534445893fa to your computer and use it in GitHub Desktop.
Add archive settings default for a custom post type
<?php
/**
* Add archive settings default for a custom post type
*/
add_filter( 'genesis_cpt_archive_settings_defaults', 'cpt_as_testimony_archive_settings_defaults', 10, 2 );
/**
* Callback for Genesis 'genesis_cpt_archive_settings_defaults' filter.
*
* Add the custom settings default value for the post type 'testimony'.
*
* @param array $settings An array of settings.
* @param string $post_type The post type.
* @return array An array of settings.
*/
function cpt_as_testimony_archive_settings_defaults( $settings, $post_type ) {
//* if the post type is 'testimony', add custom default settings
if ( 'testimony' === $post_type ) {
$settings['posts_per_page'] = '';
}
return $settings;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment