Created
November 22, 2013 04:26
-
-
Save JiveDig/7594859 to your computer and use it in GitHub Desktop.
Add custom post types to archive/sitemap
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 custom post types to archive/sitemap | |
| add_filter( 'getarchives_where' , 'ucc_getarchives_where_filter' , 10 , 2 ); | |
| function ucc_getarchives_where_filter( $where , $r ) { | |
| $args = array( 'public' => true , '_builtin' => false ); | |
| $output = 'names'; $operator = 'and'; | |
| $post_types = get_post_types( $args , $output , $operator ); $post_types = array_merge( $post_types , array( 'post' ) ); $post_types = "'" . implode( "' , '" , $post_types ) . "'"; | |
| return str_replace( "post_type = 'post'" , "post_type IN ( $post_types )" , $where ); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment