In this answer, I have shared how do you use a CPT as the default home page? Use following code in your theme’s functions.php file OR in site specific plugin.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /** * Use a CPT as the default home page. */ function fwm_add_pages_to_dropdown( $pages, $r ){ if('page_on_front' == $r['name']){ $args = array( 'post_type' => 'stack' ); $stacks = get_posts($args); $pages = array_merge($pages, $stacks); } return $pages; } add_filter( 'get_pages', 'fwm_add_pages_to_dropdown', 10, 2 ); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.