Created
June 23, 2014 11:45
-
-
Save bi0xid/f8149a2235c90ed1295d to your computer and use it in GitHub Desktop.
Add CPT as front page
This file contains 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_filter( 'get_pages', 'add_my_cpt' ); | |
function add_my_cpt( $pages ) | |
{ | |
$my_cpt_pages = new WP_Query( array( 'post_type' => 'my_cpt' ) ); | |
if ( $my_cpt_pages->post_count > 0 ) | |
{ | |
$pages = array_merge( $pages, $my_cpt_pages->posts ); | |
} | |
return $pages; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment