Created
January 8, 2016 21:45
-
-
Save rfmeier/dc0d950b1534445893fa to your computer and use it in GitHub Desktop.
Add archive settings default for a custom post type
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 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