Changeset 15937
- Timestamp:
- 10/23/2010 07:20:47 PM (14 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r15936 r15937 860 860 * types and page labels for hierarchical ones. You can see accepted values in {@link get_post_type_labels()}. 861 861 * - permalink_epmask - The default rewrite endpoint bitmasks. 862 * - has_archive - Whether to have a post type archive. Will generate the proper rewrite rules if rewrite is enabled.862 * - has_archive - True to enable post type archives. Will generate the proper rewrite rules if rewrite is enabled. 863 863 * - rewrite - false to prevent rewrite. Defaults to true. Use array('slug'=>$slug) to customize permastruct; 864 864 * default will use $post_type as slug. Other options include 'with_front' and 'feeds'. -
trunk/wp-includes/query.php
r15936 r15937 101 101 * Is the query for an archive page? 102 102 * 103 * Month, Year, Category, Author, ... 104 * 105 * If the $post_types parameter is specified, this function will additionally 106 * check if the query is for exactly one of the post types specified. If a plugin 107 * is causing multiple post types to appear in the query, specifying a post type 108 * will cause this check to return false. 103 * Month, Year, Category, Author, Post Type archive... 109 104 * 110 105 * @see WP_Query::is_archive() … … 112 107 * @uses $wp_query 113 108 * 114 * @param mixed $post_types Optional. Post type or array of post types115 109 * @return bool 116 110 */ … … 2645 2639 * Is the query for an archive page? 2646 2640 * 2647 * Month, Year, Category, Author, ... 2648 * 2649 * If the $post_types parameter is specified, this function will additionally 2650 * check if the query is for exactly one of the post types specified. If a plugin 2651 * is causing multiple post types to appear in the query, specifying a post type 2652 * will cause this check to return false. 2641 * Month, Year, Category, Author, Post Type archive... 2653 2642 * 2654 2643 * @since 3.1.0 2655 2644 * 2656 * @param mixed $post_types Optional. Post type or array of post types2657 2645 * @return bool 2658 2646 */ 2659 2647 function is_archive( $post_types ) { 2660 if ( empty( $post_types ) || !$this->is_archive ) 2661 return (bool) $this->is_archive; 2662 2663 if ( ! isset( $this->posts[0] ) ) 2664 return false; 2665 2666 $post = $this->posts[0]; 2667 2668 return in_array( $post->post_type, (array) $post_types ); 2648 return (bool) $this->is_archive; 2669 2649 } 2670 2650
Note: See TracChangeset
for help on using the changeset viewer.