Ticket #20359: category-template-#20359.php.diff

File category-template-#20359.php.diff, 3.0 KB (added by Marventus, 14 months ago)

Enhances $use_desc_for_title in 'category-template.php' and 'deprecated.php'

  • category-template.php

     
    390390 * in the category. 
    391391 *     'hide_empty' (bool|int) default is 1 - Whether to hide categories that 
    392392 * don't have any posts attached to them. 
    393  *     'use_desc_for_title' (bool|int) default is 1 - Whether to use the 
    394  * description instead of the category title. 
     393 *     'use_desc_for_title' (string) default is 'desc' - Control title attributes 
     394 * of category links. 'desc' => Output cat descriptions; 'viewall' => Output 
     395 * 'View all posts filed under @category'; 'none' => Does not output titles. 
    395396 *     'feed' - See {@link get_categories()}. 
    396397 *     'feed_type' - See {@link get_categories()}. 
    397398 *     'feed_image' - See {@link get_categories()}. 
     
    415416                'orderby' => 'name', 'order' => 'ASC', 
    416417                'style' => 'list', 
    417418                'show_count' => 0, 'hide_empty' => 1, 
    418                 'use_desc_for_title' => 1, 'child_of' => 0, 
     419                'use_desc_for_title' => 'desc', 'child_of' => 0, 
    419420                'feed' => '', 'feed_type' => '', 
    420421                'feed_image' => '', 'exclude' => '', 
    421422                'exclude_tree' => '', 'current_category' => 0, 
     
    826827                $cat_name = esc_attr( $category->name ); 
    827828                $cat_name = apply_filters( 'list_cats', $cat_name, $category ); 
    828829                $link = '<a href="' . esc_attr( get_term_link($category) ) . '" '; 
    829                 if ( $use_desc_for_title == 0 || empty($category->description) ) 
     830                if ( $use_desc_for_title === 'desc' ) 
     831                        $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"'; 
     832                elseif ( $use_desc_for_title === 'viewall' ) 
    830833                        $link .= 'title="' . esc_attr( sprintf(__( 'View all posts filed under %s' ), $cat_name) ) . '"'; 
    831                 else 
    832                         $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"'; 
     834                elseif ( $use_desc_for_title === 'none' ) 
     835                        $link = $link; 
    833836                $link .= '>'; 
    834837                $link .= $cat_name . '</a>'; 
    835838 
  • deprecated.php

     
    622622 * @param int $optiondates 
    623623 * @param int $optioncount 
    624624 * @param int $hide_empty 
    625  * @param int $use_desc_for_title 
     625 * @param string $use_desc_for_title 
    626626 * @param bool $children 
    627627 * @param int $child_of 
    628628 * @param int $categories 
     
    634634 * @return unknown 
    635635 */ 
    636636function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, 
    637                                    $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, 
     637                                   $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 'desc', $children=false, $child_of=0, $categories=0, 
    638638                                   $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { 
    639639        _deprecated_function( __FUNCTION__, '2.1', 'wp_list_categories()' ); 
    640640