Make WordPress Core

Changeset 33767


Ignore:
Timestamp:
08/27/2015 02:08:31 AM (11 years ago)
Author:
boonebgorges
Message:

Rename param added to wp_list_categories() in [33764] to 'hide_title_if_empty'.

Props vilkatis, DrewAPicture.
Fixes #33565.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/category-template.php

    r33765 r33767  
    462462 *
    463463 * @since 2.1.0
    464  * @since 4.4.0 Introduced the `hide_title_if_no_cats` argument.
     464 * @since 4.4.0 Introduced the `hide_title_if_empty` argument.
    465465 *
    466466 * @param string|array $args {
     
    494494 *     @type string       $title_li              Text to use for the list title `<li>` element. Pass an empty string
    495495 *                                               to disable. Default 'Categories'.
    496  *     @type bool         $hide_title_if_no_cats Whether to hide the `$title_li` element if there are no terms in
     496 *     @type bool         $hide_title_if_empty  Whether to hide the `$title_li` element if there are no terms in
    497497 *                                               the list. Default false (title will always be shown).
    498498 *     @type int          $depth                 Category depth. Used for tab indentation. Default 0.
     
    512512                'exclude_tree' => '', 'current_category' => 0,
    513513                'hierarchical' => true, 'title_li' => __( 'Categories' ),
    514                 'hide_title_if_no_cats' => false,
     514                'hide_title_if_empty' => false,
    515515                'echo' => 1, 'depth' => 0,
    516516                'taxonomy' => 'category'
     
    540540
    541541        $output = '';
    542         if ( $r['title_li'] && 'list' == $r['style'] && ( ! empty( $categories ) || ! $r['hide_title_if_no_cats'] ) ) {
     542        if ( $r['title_li'] && 'list' == $r['style'] && ( ! empty( $categories ) || ! $r['hide_title_if_empty'] ) ) {
    543543                $output = '<li class="' . esc_attr( $r['class'] ) . '">' . $r['title_li'] . '<ul>';
    544544        }
  • trunk/tests/phpunit/tests/category/wpListCategories.php

    r33764 r33767  
    213213         * @ticket 33460
    214214         */
    215         public function test_hide_title_if_no_cats_should_be_respected_for_empty_lists_when_true() {
    216                 $found = wp_list_categories( array(
    217                         'echo' => false,
    218                         'hide_title_if_no_cats' => true,
     215        public function test_hide_title_if_empty_should_be_respected_for_empty_lists_when_true() {
     216                $found = wp_list_categories( array(
     217                        'echo' => false,
     218                        'hide_title_if_empty' => true,
    219219                ) );
    220220
     
    225225         * @ticket 33460
    226226         */
    227         public function test_hide_title_if_no_cats_should_be_respected_for_empty_lists_when_false() {
    228                 $found = wp_list_categories( array(
    229                         'echo' => false,
    230                         'hide_title_if_no_cats' => false,
     227        public function test_hide_title_if_empty_should_be_respected_for_empty_lists_when_false() {
     228                $found = wp_list_categories( array(
     229                        'echo' => false,
     230                        'hide_title_if_empty' => false,
    231231                ) );
    232232
     
    237237         * @ticket 33460
    238238         */
    239         public function test_hide_title_if_no_cats_should_be_ignored_when_category_list_is_not_empty() {
     239        public function test_hide_title_if_empty_should_be_ignored_when_category_list_is_not_empty() {
    240240                $cat = $this->factory->category->create();
    241241
     
    243243                        'echo' => false,
    244244                        'hide_empty' => false,
    245                         'hide_title_if_no_cats' => true,
     245                        'hide_title_if_empty' => true,
    246246                ) );
    247247
Note: See TracChangeset for help on using the changeset viewer.