class.addons.php
3 months ago
class.functions.php
3 months ago
class.interface.php
3 months ago
class.options.php
3 months ago
class.terms_walker.php
3 months ago
class.tto.php
3 months ago
class.terms_walker.php
51 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 4 | |
| 5 | class TO_Terms_Walker extends Walker |
| 6 | { |
| 7 | |
| 8 | var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); |
| 9 | |
| 10 | |
| 11 | function start_lvl(&$output, $depth = 0, $args = array() ) |
| 12 | { |
| 13 | extract($args, EXTR_SKIP); |
| 14 | |
| 15 | $indent = str_repeat("\t", $depth); |
| 16 | $output .= "\n$indent<ul class='children sortable'>\n"; |
| 17 | } |
| 18 | |
| 19 | |
| 20 | function end_lvl(&$output, $depth = 0, $args = array()) |
| 21 | { |
| 22 | extract($args, EXTR_SKIP); |
| 23 | |
| 24 | $indent = str_repeat("\t", $depth); |
| 25 | $output .= "$indent</ul>\n"; |
| 26 | } |
| 27 | |
| 28 | |
| 29 | function start_el(&$output, $term, $depth = 0, $args = array(), $current_object_id = 0) |
| 30 | { |
| 31 | if ( $depth ) |
| 32 | $indent = str_repeat("\t", $depth); |
| 33 | else |
| 34 | $indent = ''; |
| 35 | |
| 36 | $currentScreen = get_current_screen(); |
| 37 | |
| 38 | $term_link = isset ( $currentScreen->post_type ) ? get_edit_term_link( $term, $term->taxonomy, $currentScreen->post_type ) : get_edit_term_link( $term ); |
| 39 | |
| 40 | $output .= $indent . '<li class="term_type_li" id="item_'.$term->term_id.'"><div class="item"><span class="title">'.apply_filters( 'to/term_title', $term->name, $term ).' </span> <span class="options ui-sortable-handle"><a href="' . $term_link .'"><span class="dashicons dashicons-edit"></span></a></span></div>'; |
| 41 | } |
| 42 | |
| 43 | |
| 44 | function end_el(&$output, $object, $depth = 0, $args = array()) |
| 45 | { |
| 46 | $output .= "</li>\n"; |
| 47 | } |
| 48 | |
| 49 | } |
| 50 | |
| 51 | ?> |