489 | | * @type string $show_option_all Text to display for showing all categories. Default empty string. |
490 | | * @type string $show_option_none Text to display for the 'no categories' option. |
491 | | * Default 'No categories'. |
492 | | * @type string $orderby The column to use for ordering categories. Default 'ID'. |
493 | | * @type string $order Which direction to order categories. Accepts 'ASC' or 'DESC'. |
494 | | * Default 'ASC'. |
495 | | * @type bool|int $show_count Whether to show how many posts are in the category. Default 0. |
496 | | * @type bool|int $hide_empty Whether to hide categories that don't have any posts attached to them. |
497 | | * Default 1. |
498 | | * @type bool|int $use_desc_for_title Whether to use the category description as the title attribute. |
499 | | * Default 1. |
500 | | * @type string $feed Text to use for the feed link. Default 'Feed for all posts filed |
501 | | * under [cat name]'. |
502 | | * @type string $feed_type Feed type. Used to build feed link. See {@link get_term_feed_link()}. |
503 | | * Default empty string (default feed). |
504 | | * @type string $feed_image URL of an image to use for the feed link. Default empty string. |
505 | | * @type int $child_of Term ID to retrieve child terms of. See {@link get_terms()}. Default 0. |
506 | | * @type array|string $exclude Array or comma/space-separated string of term IDs to exclude. |
507 | | * If `$hierarchical` is true, descendants of `$exclude` terms will also |
508 | | * be excluded; see `$exclude_tree`. See {@link get_terms()}. |
509 | | * Default empty string. |
510 | | * @type array|string $exclude_tree Array or comma/space-separated string of term IDs to exclude, along |
511 | | * with their descendants. See {@link get_terms()}. Default empty string. |
512 | | * @type bool|int $echo True to echo markup, false to return it. Default 1. |
513 | | * @type int|array $current_category ID of category, or array of IDs of categories, that should get the |
514 | | * 'current-cat' class. Default 0. |
515 | | * @type bool $hierarchical Whether to include terms that have non-empty descendants. |
516 | | * See {@link get_terms()}. Default true. |
517 | | * @type string $title_li Text to use for the list title `<li>` element. Pass an empty string |
518 | | * to disable. Default 'Categories'. |
519 | | * @type bool $hide_title_if_empty Whether to hide the `$title_li` element if there are no terms in |
520 | | * the list. Default false (title will always be shown). |
521 | | * @type int $depth Category depth. Used for tab indentation. Default 0. |
522 | | * @type string $taxonomy Taxonomy name. Default 'category'. |
523 | | * @type string $separator Separator between links. Default '<br />'. |
| 494 | * @type string $taxonomy Taxonomy. Default 'category'. |
| 499 | $r = wp_parse_args( $args, array( 'taxonomy' => 'category' ) ); |
| 500 | |
| 501 | $original_echo_value = $r['echo']; |
| 502 | |
| 503 | // Force to false to allow for passing through back-compat filters. |
| 504 | $r['echo'] = false; |
| 505 | |
| 506 | // Back-compat for old 'current_category' argument. |
| 507 | if ( ! empty ( $r['current_category'] ) ) { |
| 508 | $r['current_term'] = $r['current_category']; |
| 509 | } |
| 510 | |
| 511 | $output = wp_list_terms( $r ); |
| 512 | |
| 513 | /** |
| 514 | * Filter the HTML output of a categories list. |
| 515 | * |
| 516 | * @since 2.1.0 |
| 517 | * |
| 518 | * @param string $output HTML output. |
| 519 | * @param array $args An array of taxonomy-listing arguments. |
| 520 | */ |
| 521 | $html = apply_filters( 'wp_list_categories', $output, $args ); |
| 522 | |
| 523 | if ( $original_echo_value ) { |
| 524 | echo $html; |
| 525 | } else { |
| 526 | return $html; |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | /** |
| 531 | * Displays or retrieves an HTML list of terms. |
| 532 | * |
| 533 | * @since 4.6.0 |
| 534 | * |
| 535 | * @see get_terms() |
| 536 | * |
| 537 | * @param string|array $args { |
| 538 | * Array of arguments to retrieve or display an HTML list of terms. |
| 539 | * |
| 540 | * @type int $child_of Term ID to retrieve child terms of. Default 0. |
| 541 | * @type int|array $current_term Term ID, or array of term IDs that should get the 'current-term' class. |
| 542 | * Default 0. |
| 543 | * @type int $depth Category depth. Used for tab indentation. Default 0. |
| 544 | * @type bool|int $echo True to echo markup, false to return it. Default 1|true. |
| 545 | * @type array|string $exclude Array or comma/space-separated string of term IDs to exclude. |
| 546 | * If `$hierarchical` is true, descendants of `$exclude` terms will also |
| 547 | * be excluded; see `$exclude_tree`. Default empty string. |
| 548 | * @type array|string $exclude_tree Array or comma/space-separated string of term IDs to exclude, along |
| 549 | * with their descendants. Default empty string. |
| 550 | * @type string $feed Text to use for the feed link. Default 'Feed for all posts filed |
| 551 | * under [term name]'. |
| 552 | * @type string $feed_image URL of an image to use for the feed link. Default empty string. |
| 553 | * @type string $feed_type Feed type. Used to build feed link. See get_term_feed_link(). |
| 554 | * Default empty string (default feed). |
| 555 | * @type bool|int $hide_empty Whether to hide terms that don't have any posts attached to them. |
| 556 | * Default 1|true. |
| 557 | * @type bool $hide_title_if_empty Whether to hide the `$title_li` element if there are no terms in |
| 558 | * the list. Default false (title will always be shown). |
| 559 | * @type bool $hierarchical Whether to include terms that have non-empty descendants. |
| 560 | * Default true. |
| 561 | * @type string $order Which direction to order terms. Accepts 'ASC' or 'DESC'. Default 'ASC'. |
| 562 | * @type string $orderby The column to use for ordering terms. Default 'ID'. |
| 563 | * @type string $separator Separator between links. Default '<br />'. |
| 564 | * @type bool|int $show_count Whether to show how many posts are in the term. Default 0|false. |
| 565 | * @type string $show_option_all Text to display for showing all terms. Default empty string. |
| 566 | * @type string $show_option_none Text to display for the 'no terms' option. Default is the value |
| 567 | * of the 'no_terms' taxonomy label. |
| 568 | * @type string $taxonomy Taxonomy name. Default null (required). |
| 569 | * @type string $title_li Text to use for the list title `<li>` element. Pass an empty string |
| 570 | * to disable. Default is the value of the 'name' label for `$taxonomy`. |
| 571 | * @type bool|int $use_desc_for_title Whether to use the term description as the title attribute. |
| 572 | * Default 1|true. |
| 573 | * } |
| 574 | * @return false|string HTML content only if 'echo' argument is 0|false. False if the taxonomy doesn't exist. |
| 575 | */ |
| 576 | function wp_list_terms( $args = array() ) { |