| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.9/wp-content/themes/dt-the7/inc/ |
Upload File : |
<?php
/**
* The7 class for page based navigation.
*
* @since 7.6.0
*
* @package The7
*/
defined( 'ABSPATH' ) || exit;
/**
* Class The7_Page_Walker
*/
class The7_Walker_Page extends Walker_Page {
private $dt_menu_parents = array();
private $dt_is_first = true;
/**
* Traverse elements to create list from elements.
*
* Calls parent function in wp-includes/class-wp-walker.php
*/
function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
if ( ! $element ) {
return;
}
//Add indicators for top level menu items with submenus
$id_field = $this->db_fields['id'];
if ( ! empty( $children_elements[ $element->$id_field ] ) ) {
$this->dt_menu_parents[] = $element->$id_field;
}
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
}
function start_lvl( &$output, $depth = 0, $args = array() ) {
$this->dt_is_first = true;
$output .= '<ul class="' . esc_attr( $args['submenu_class'] ) . '">';
}
function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
if ( $depth ) {
$indent = str_repeat( "\t", $depth );
} else {
$indent = '';
}
$css_class = array( 'menu-item', 'page_item', 'page-item-' . $page->ID );
if ( isset( $args['pages_with_children'][ $page->ID ] ) ) {
$css_class[] = 'page_item_has_children';
}
if ( ! empty( $current_page ) ) {
$_current_page = get_post( $current_page );
if ( $_current_page && in_array( $page->ID, $_current_page->ancestors, false ) ) {
$css_class[] = 'current_page_ancestor';
}
if ( $page->ID === (int) $current_page ) {
$css_class[] = 'current_page_item';
$css_class[] = 'act';
} elseif ( $_current_page && $page->ID === (int) $_current_page->post_parent ) {
$css_class[] = 'current_page_parent';
}
} elseif ( $page->ID === (int) get_option('page_for_posts') ) {
$css_class[] = 'current_page_parent';
}
if ( $this->dt_is_first ) {
$css_class[] = 'first';
}
$dt_is_parent = in_array( $page->ID, $this->dt_menu_parents, false );
// add parent class
if ( $dt_is_parent ) {
$css_class[] = 'has-children';
}
$atts = array();
$atts['href'] = get_permalink( $page->ID );
if ( $dt_is_parent && ! $args['parent_is_clickable'] ) {
$atts['class'] = 'not-clickable-item';
}
$attributes = the7_get_html_attributes_string( $atts );
$css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
if ( '' === $page->post_title ) {
/* translators: %d: ID of a post */
$page->post_title = sprintf( __( '#%d (no title)', 'the7mk2' ), $page->ID );
}
$args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before'];
$args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after'];
$output .= $indent . sprintf(
'<li class="%s"><a %s>%s%s%s</a>',
$css_classes,
$attributes,
$args['link_before'],
'<span class="menu-item-text"><span class="menu-text">' . apply_filters( 'the_title', $page->post_title, $page->ID ) . '</span></span>',
$args['link_after']
);
if ( ! empty( $args['show_date'] ) ) {
if ( 'modified' === $args['show_date'] ) {
$time = $page->post_modified;
} else {
$time = $page->post_date;
}
$date_format = empty( $args['date_format'] ) ? '' : $args['date_format'];
$output .= ' ' . mysql2date( $date_format, $time );
}
}
function end_lvl( &$output, $depth = 0, $args = array() ) {
$output .= '</ul>';
}
function end_el( &$output, $page, $depth = 0, $args = array() ) {
$this->dt_is_first = false;
$output .= '</li>';
}
}