Make WordPress Core


Ignore:
Timestamp:
12/03/2010 10:13:17 AM (16 years ago)
Author:
nacin
Message:

Post format indexes. First pass. see #15378.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r16691 r16705  
    2020                'update_count_callback' => '_update_post_term_count',
    2121                'query_var' => 'category_name',
    22                 'rewrite' => array(
     22                'rewrite' => did_action( 'init' ) ? array(
    2323                                        'hierarchical' => true,
    2424                                        'slug' => get_option('category_base') ? get_option('category_base') : 'category',
    25                                         'with_front' => false),
     25                                        'with_front' => false) : false,
    2626                'public' => true,
    2727                'show_ui' => true,
    … …  
    3333                'update_count_callback' => '_update_post_term_count',
    3434                'query_var' => 'tag',
    35                 'rewrite' => array(
    36                                         'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag' ,
    37                                         'with_front' => false),
     35                'rewrite' => did_action( 'init' ) ? array(
     36                                        'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag',
     37                                        'with_front' => false) : false,
    3838                'public' => true,
    3939                'show_ui' => true,
    … …  
    5353                '_builtin' => true,
    5454                'show_in_nav_menus' => false,
    55         ) ) ;
     55        ) );
    5656
    5757        register_taxonomy( 'link_category', 'link', array(
    … …  
    7676                'show_ui' => false,
    7777                '_builtin' => true,
    78         ) ) ;
     78        ) );
     79
     80        $rewrite = false;
     81        if ( did_action( 'init' ) && current_theme_supports( 'post-formats' ) ) {
     82                $rewrite = apply_filters( 'post_format_rewrite_base', 'type' );
     83                $rewrite = $rewrite ? array( 'slug' => $rewrite ) : false;
     84        }
    7985
    8086        register_taxonomy( 'post_format', 'post', array(
    81                 'public' => false,
     87                'public' => true,
    8288                'hierarchical' => false,
    8389                'labels' => array(
    … …  
    8591                        'singular_name' => '',
    8692                ),
    87                 'query_var' => false,
    88                 'rewrite' => false,
     93                'query_var' => 'post_format',
     94                'rewrite' => $rewrite,
    8995                'show_ui' => false,
    9096                '_builtin' => true,
    9197                'show_in_nav_menus' => false,
    92         ) ) ;
     98        ) );
    9399}
    94100add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
    … …  
    311317        }
    312318
    313         if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') && !empty($wp_rewrite) ) {
     319        if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') ) {
    314320                $args['rewrite'] = wp_parse_args($args['rewrite'], array(
    315321                        'slug' => sanitize_title_with_dashes($taxonomy),
Note: See TracChangeset for help on using the changeset viewer.