Make WordPress Core

Ticket #19958: CustomPostTypeAsHomePages.patch

File CustomPostTypeAsHomePages.patch, 3.0 KB (added by pbearne, 12 years ago)

incomplete patch

  • wp-admin/options-reading.php

     
    114114        </label>
    115115        </p>
    116116<ul>
    117         <li><label for="page_on_front"><?php printf( __( 'Front page: %s' ), wp_dropdown_pages( array( 'name' => 'page_on_front', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), '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' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_on_front' ) ) ) ) ); ?></label></li>
    118118        <li><label for="page_for_posts"><?php printf( __( 'Posts page: %s' ), wp_dropdown_pages( array( 'name' => 'page_for_posts', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_for_posts' ) ) ) ); ?></label></li>
    119119</ul>
    120120<?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
  • wp-includes/post.php

     
    36283628        $number = (int) $number;
    36293629        $offset = (int) $offset;
    36303630
    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
    36323637        $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) )
    36343639                return $pages;
    36353640
    36363641        // Make sure we have a valid post status
     
    37333738        if ( $parent >= 0 )
    37343739                $where .= $wpdb->prepare(' AND post_parent = %d ', $parent);
    37353740
     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
    37363749        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 ) );
    37383751        } else {
    37393752                $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')" ;
    37413754        }
    37423755
    37433756        $orderby_array = array();