Ticket #19958: CustomPostTypeAsHomePages.patch
File CustomPostTypeAsHomePages.patch, 3.0 KB (added by , 12 years ago) |
---|
-
wp-admin/options-reading.php
114 114 </label> 115 115 </p> 116 116 <ul> 117 <li><label for="page_on_front"><?php printf( __( 'Front page: %s' ), wp_dropdown_pages( a rray( 'name' => 'page_on_front', 'echo' => 0, 'show_option_none' => __( '— Select —' ), 'option_none_value' => '0', 'selected' => get_option( 'page_on_front') ) ) ); ?></label></li>117 <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> 118 118 <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> 119 119 </ul> 120 120 <?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?> -
wp-includes/post.php
3628 3628 $number = (int) $number; 3629 3629 $offset = (int) $offset; 3630 3630 3631 // Make sure the post type is hierarchical 3631 // Make sure we have a valid post type 3632 if ( !is_array( $post_type ) ) 3633 $post_type = explode( ',', $post_type ); 3634 if ( array_diff( $post_type, get_post_types() ) ) 3635 return $pages; 3636 // Make sure the all post types are hierarchical 3632 3637 $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) ); 3633 if ( !in_array( $post_type, $hierarchical_post_types) )3638 if ( array_intersect( $post_type, $hierarchical_post_types ) == count($post_type) ) 3634 3639 return $pages; 3635 3640 3636 3641 // Make sure we have a valid post status … … 3733 3738 if ( $parent >= 0 ) 3734 3739 $where .= $wpdb->prepare(' AND post_parent = %d ', $parent); 3735 3740 3741 // Check if post_type is an array so that Custom Page types can be added to dropdowns and lists 3742 if ( 1 == count( $post_type ) ) { 3743 $where_post_type = $wpdb->prepare("post_type = %s" , array_shift( $post_type ) ); 3744 } else{ 3745 $post_type = implode( "', '", $post_type ); 3746 $where_post_type = "post_type IN ('$post_type')"; 3747 } 3748 3736 3749 if ( 1 == count( $post_status ) ) { 3737 $where_post_type = $wpdb->prepare( "post_type = %s AND post_status = %s", $post_type,array_shift( $post_status ) );3750 $where_post_type .= $wpdb->prepare( " AND post_status = %s", array_shift( $post_status ) ); 3738 3751 } else { 3739 3752 $post_status = implode( "', '", $post_status ); 3740 $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $post_type );3753 $where_post_type .= "AND post_status IN ('$post_status')" ; 3741 3754 } 3742 3755 3743 3756 $orderby_array = array();