[wp-trac] [WordPress Trac] #19958: Allow custom post types as "home"
WordPress Trac
noreply at wordpress.org
Mon Nov 19 19:23:36 UTC 2012
#19958: Allow custom post types as "home"
----------------------------+------------------------------
Reporter: sooskriszta | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 3.3.1
Severity: major | Resolution:
Keywords: |
----------------------------+------------------------------
Comment (by pbearne):
Yes feels that it would work
wp_dropdown_pages() call's get_pages() just passing the args through and
get_pages() takes in post_type
And if we update the custom post/page type page to inform how to add this
I don't see the need to add it to the posts page as this is just a place
holder so remove that from the code.
Added (untested) code to make the filter work with any number of filters
so that this call can be part of custom post/page type page setups.
{{{
function filter_my_cpt($args) {
// pass through current value if any to allow for other filters
if(count($args[post_type])>0){
$args[post_type] = array_push($args[post_type],'cpt-slug');
}else{
$args[post_type] = 'cpt-slug';
}
}
add_filter('options-front-page' , filter_my_cpt');
}}}
so the change to options-reading.php would just a filter around the front
page $args array
I that feel we should break this out a bit to make readable but this looks
like the code we need.
{{{
117<ul>
<li><label for="page_on_front"><?php printf( __( 'Front page: %s' ),
wp_dropdown_pages(apply_filters('options-front-page', array( 'name' =>
'page_on_front', 'echo' => 0, 'show_option_none' => __( '— Select
—' ), 'option_none_value' => '0', 'selected' => get_option(
'page_on_front' ) ) ) ) ); ?></label></li>
<li><label for="page_for_posts"><?php printf( __( 'Posts page: %s' ),
wp_dropdown_pages( array( 'name' => 'page_for_posts', 'echo' => 0,
'show_option_none' => __( '— Select —' ), 'option_none_value'
=> '0', 'selected' => get_option( 'page_for_posts' ) ) ) );
?></label></li>
</ul>
}}}
Does this all make sense?
Paul
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19958#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list