| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Modules\PostTypesOrder; |
| 4 |
|
| 5 |
// no direct access allowed |
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; |
| 8 |
} |
| 9 |
|
| 10 |
/** |
| 11 |
* WP Adminify |
| 12 |
* |
| 13 |
* @package WP Adminify: Post Types Order |
| 14 |
* |
| 15 |
* @author WP Adminify <support@wpadminify.com> |
| 16 |
*/ |
| 17 |
|
| 18 |
|
| 19 |
class PostTypesOrderWalker extends \Walker { |
| 20 |
|
| 21 |
|
| 22 |
var $db_fields = [ |
| 23 |
'parent' => 'post_parent', |
| 24 |
'id' => 'ID', |
| 25 |
]; |
| 26 |
|
| 27 |
|
| 28 |
function start_lvl( &$output, $depth = 0, $args = [] ) { |
| 29 |
$indent = str_repeat( "\t", $depth ); |
| 30 |
$output .= "\n$indent<ul class='children'>\n"; |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
function end_lvl( &$output, $depth = 0, $args = [] ) { |
| 35 |
$indent = str_repeat( "\t", $depth ); |
| 36 |
$output .= "$indent</ul>\n"; |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
function start_el( &$output, $page, $depth = 0, $args = [], $id = 0 ) { |
| 41 |
if ( $depth ) { |
| 42 |
$indent = str_repeat( "\t", $depth ); |
| 43 |
} else { |
| 44 |
$indent = ''; |
| 45 |
} |
| 46 |
|
| 47 |
extract( $args, EXTR_SKIP ); |
| 48 |
|
| 49 |
$item_details = apply_filters( 'the_title', $page->post_title, $page->ID ); |
| 50 |
|
| 51 |
$item_details = apply_filters( 'adminify_pto/pto_media_item_data', $item_details, $page ); |
| 52 |
|
| 53 |
$output .= $indent . '<li id="item_' . esc_attr( $page->ID ) . '"><span>' . esc_html( $item_details ) . '</span>'; |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
function end_el( &$output, $page, $depth = 0, $args = [] ) { |
| 58 |
$output .= "</li>\n"; |
| 59 |
} |
| 60 |
} |
| 61 |
|