Changeset 1422766
- Timestamp:
- 05/24/2016 12:57:57 AM (10 years ago)
- Location:
- extended-categories-widget/trunk
- Files:
-
- 3 edited
-
4.2/class/avh-ec.core.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
widget_extended_categories.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
extended-categories-widget/trunk/4.2/class/avh-ec.core.php
r1422563 r1422766 445 445 * } 446 446 * @return false|string HTML content only if 'echo' argument is 0. 447 * 448 *public function avh_wp_list_categories($args = '') {449 *$mywalker = new AVHEC_Walker_Category();450 *$defaults = array(451 *'child_of' => 0,452 *'current_category' => 0,453 *'depth' => 0,454 *'echo' => 1,455 *'exclude' => '',456 *'exclude_tree' => '',457 *'feed' => '',458 *'feed_image' => '',459 *'feed_type' => '',460 *'hide_empty' => 1,461 *'hide_title_if_empty' => false,462 *'hierarchical' => true,463 *'order' => 'ASC',464 *'orderby' => 'name',465 *'separator' => '<br />',466 *'show_count' => 0,467 *'show_last_update' => 0,468 *'show_option_all' => '',469 *'show_option_none' => __('No categories'),470 *'style' => 'list',471 *'taxonomy' => 'category',472 *'title_li' => __('Categories'),473 *'use_desc_for_title' => 1,474 *'walker' => $mywalker475 *);476 * 477 *$r = wp_parse_args($args, $defaults);478 * 479 *if ( ! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {480 *$r['pad_counts'] = true;481 *}482 * 483 *if (isset($r['show_date'])) {484 *$r['include_last_update_time'] = $r['show_date'];485 *}486 * 487 *if (true == $r['hierarchical']) {488 *$exclude_tree = array();489 * 490 *if ($r['exclude_tree']) {491 *$exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude_tree']));492 *}493 * 494 *if ($r['exclude']) {495 *$exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude']));496 *}497 * 498 *$r['exclude_tree'] = $exclude_tree;499 *$r['exclude'] = '';500 *}501 * 502 *if ( ! isset($r['class'])) {503 *$r['class'] = ('category' == $r['taxonomy']) ? 'categories' : $r['taxonomy'];504 *}505 * 506 *if ( ! taxonomy_exists($r['taxonomy'])) {507 *return false;508 *}509 * 510 *$show_option_all = $r['show_option_all'];511 *$show_option_none = $r['show_option_none'];512 * 513 *$categories = get_categories($r);514 * 515 *$output = '';516 *if ($r['title_li'] && 'list' == $r['style'] && ( ! empty($categories) || ! $r['hide_title_if_empty'])) {517 *$output = '<li class="' . esc_attr($r['class']) . '">' . $r['title_li'] . '<ul>';518 *}519 * 520 *if (empty($categories)) {521 *if ( ! empty($show_option_none)) {522 *if ('list' == $r['style']) {523 *$output .= '<li class="cat-item-none">' . __("No categories") . '</li>';524 *} else {525 *$output .= $show_option_none;526 *}527 *}528 *} else {529 *if ( ! empty($show_option_all)) {530 * 531 *$posts_page = '';532 *$taxonomy_object = get_taxonomy($r['taxonomy']);533 * 534 *if ( ! in_array('post', $taxonomy_object->object_type) &&535 *! in_array('page', $taxonomy_object->object_type)536 *) {537 *foreach ($taxonomy_object->object_type as $object_type) {538 *$_object_type = get_post_type_object($object_type);539 * 540 *// Grab the first one.541 *if ( ! empty($_object_type->has_archive)) {542 *$posts_page = get_post_type_archive_link($object_type);543 *break;544 *}545 *}546 *}547 *// Fallback for the 'All' link is the posts page.548 *if ( ! $posts_page) {549 *if ('page' == get_option('show_on_front') && get_option('page_for_posts')) {550 *$posts_page = get_permalink(get_option('page_for_posts'));551 *} else {552 *$posts_page = home_url('/');553 *}554 *}555 * 556 *$posts_page = esc_url($posts_page);557 *if ('list' == $r['style']) {558 *$output .= '<li class="cat-item-all"><a href="' .559 *$posts_page .560 *'">' .561 *$show_option_all .562 *'</a></li>';563 *} else {564 *$output .= '<a href="' . $posts_page . '">' . $show_option_all . '</a>';565 *}566 *}567 *if (empty($r['current_category']) && (is_category() || is_tax() || is_tag())) {568 *$current_term_object = get_queried_object();569 *if ($current_term_object && $r['taxonomy'] === $current_term_object->taxonomy) {570 *$r['current_category'] = get_queried_object_id();571 *}572 *}573 * 574 *if ($r['hierarchical']) {575 *$depth = $r['depth'];576 *} else {577 *$depth = - 1; // Flat.578 *}579 * 580 *$output .= walk_category_tree($categories, $depth, $r);581 *}582 * 583 *if ($r['title_li'] && 'list' == $r['style']) {584 *$output .= '</ul></li>';585 *}586 * 587 *$html = apply_filters('wp_list_categories', $output, $args);588 * 589 *if ($r['echo']) {590 *echo $html;591 *} else {592 *return $html;593 *}594 * 595 *return;596 *}597 * 598 */**447 */ 448 public function avh_wp_list_categories($args = '') { 449 $mywalker = new AVHEC_Walker_Category(); 450 $defaults = array( 451 'child_of' => 0, 452 'current_category' => 0, 453 'depth' => 0, 454 'echo' => 1, 455 'exclude' => '', 456 'exclude_tree' => '', 457 'feed' => '', 458 'feed_image' => '', 459 'feed_type' => '', 460 'hide_empty' => 1, 461 'hide_title_if_empty' => false, 462 'hierarchical' => true, 463 'order' => 'ASC', 464 'orderby' => 'name', 465 'separator' => '<br />', 466 'show_count' => 0, 467 'show_last_update' => 0, 468 'show_option_all' => '', 469 'show_option_none' => __('No categories'), 470 'style' => 'list', 471 'taxonomy' => 'category', 472 'title_li' => __('Categories'), 473 'use_desc_for_title' => 1, 474 'walker' => $mywalker 475 ); 476 477 $r = wp_parse_args($args, $defaults); 478 479 if ( ! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) { 480 $r['pad_counts'] = true; 481 } 482 483 if (isset($r['show_date'])) { 484 $r['include_last_update_time'] = $r['show_date']; 485 } 486 487 if (true == $r['hierarchical']) { 488 $exclude_tree = array(); 489 490 if ($r['exclude_tree']) { 491 $exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude_tree'])); 492 } 493 494 if ($r['exclude']) { 495 $exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude'])); 496 } 497 498 $r['exclude_tree'] = $exclude_tree; 499 $r['exclude'] = ''; 500 } 501 502 if ( ! isset($r['class'])) { 503 $r['class'] = ('category' == $r['taxonomy']) ? 'categories' : $r['taxonomy']; 504 } 505 506 if ( ! taxonomy_exists($r['taxonomy'])) { 507 return false; 508 } 509 510 $show_option_all = $r['show_option_all']; 511 $show_option_none = $r['show_option_none']; 512 513 $categories = get_categories($r); 514 515 $output = ''; 516 if ($r['title_li'] && 'list' == $r['style'] && ( ! empty($categories) || ! $r['hide_title_if_empty'])) { 517 $output = '<li class="' . esc_attr($r['class']) . '">' . $r['title_li'] . '<ul>'; 518 } 519 520 if (empty($categories)) { 521 if ( ! empty($show_option_none)) { 522 if ('list' == $r['style']) { 523 $output .= '<li class="cat-item-none">' . __("No categories") . '</li>'; 524 } else { 525 $output .= $show_option_none; 526 } 527 } 528 } else { 529 if ( ! empty($show_option_all)) { 530 531 $posts_page = ''; 532 $taxonomy_object = get_taxonomy($r['taxonomy']); 533 534 if ( ! in_array('post', $taxonomy_object->object_type) && 535 ! in_array('page', $taxonomy_object->object_type) 536 ) { 537 foreach ($taxonomy_object->object_type as $object_type) { 538 $_object_type = get_post_type_object($object_type); 539 540 // Grab the first one. 541 if ( ! empty($_object_type->has_archive)) { 542 $posts_page = get_post_type_archive_link($object_type); 543 break; 544 } 545 } 546 } 547 // Fallback for the 'All' link is the posts page. 548 if ( ! $posts_page) { 549 if ('page' == get_option('show_on_front') && get_option('page_for_posts')) { 550 $posts_page = get_permalink(get_option('page_for_posts')); 551 } else { 552 $posts_page = home_url('/'); 553 } 554 } 555 556 $posts_page = esc_url($posts_page); 557 if ('list' == $r['style']) { 558 $output .= '<li class="cat-item-all"><a href="' . 559 $posts_page . 560 '">' . 561 $show_option_all . 562 '</a></li>'; 563 } else { 564 $output .= '<a href="' . $posts_page . '">' . $show_option_all . '</a>'; 565 } 566 } 567 if (empty($r['current_category']) && (is_category() || is_tax() || is_tag())) { 568 $current_term_object = get_queried_object(); 569 if ($current_term_object && $r['taxonomy'] === $current_term_object->taxonomy) { 570 $r['current_category'] = get_queried_object_id(); 571 } 572 } 573 574 if ($r['hierarchical']) { 575 $depth = $r['depth']; 576 } else { 577 $depth = - 1; // Flat. 578 } 579 580 $output .= walk_category_tree($categories, $depth, $r); 581 } 582 583 if ($r['title_li'] && 'list' == $r['style']) { 584 $output .= '</ul></li>'; 585 } 586 587 $html = apply_filters('wp_list_categories', $output, $args); 588 589 if ($r['echo']) { 590 echo $html; 591 } else { 592 return $html; 593 } 594 595 return; 596 } 597 598 /** 599 599 * Checks if running version is newer and do upgrades if necessary 600 600 * -
extended-categories-widget/trunk/readme.txt
r1422753 r1422766 5 5 Requires at least: 2.3 6 6 Tested up to: 4.4 7 Stable tag: 4.0. 47 Stable tag: 4.0.5 8 8 9 9 The AVH Extended Categories Widgets gives you three widgets for displaying categories. … … 140 140 141 141 == Changelog == 142 = Version 4.0.5 = 143 * To much comment out. 144 142 145 = Version 4.0.4 = 143 146 * Uncaught error can occur at times. -
extended-categories-widget/trunk/widget_extended_categories.php
r1422753 r1422766 4 4 * Plugin URI: http://blog.avirtualhome.com/wordpress-plugins 5 5 * Description: Replacement of the category widget to allow for greater customization of the category widget. 6 * Version: 4.0. 46 * Version: 4.0.5 7 7 * Author: Peter van der Does 8 8 * Author URI: http://blog.avirtualhome.com/
Note: See TracChangeset
for help on using the changeset viewer.