Skip to content

Instantly share code, notes, and snippets.

@JiveDig
Created November 22, 2013 04:26
Show Gist options
  • Select an option

  • Save JiveDig/7594859 to your computer and use it in GitHub Desktop.

Select an option

Save JiveDig/7594859 to your computer and use it in GitHub Desktop.
Add custom post types to archive/sitemap
<?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