PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /home/trave494/footcrew.com/ads/wp-content/themes/classipress/includes/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : /home/trave494/footcrew.com/ads/wp-content/themes/classipress/includes/menus.php |
<?php /** * Setup the menus. * * @package ClassiPress * @since 4.0.0 */ add_action( 'after_setup_theme', 'cp_register_menus' ); /** * Register menus * * @return void */ function cp_register_menus() { register_nav_menu( 'primary_top', __( 'Topbar Navigation', APP_TD ) ); register_nav_menu( 'primary', __( 'Header Navigation', APP_TD ) ); register_nav_menu( 'secondary', __( 'Footer Navigation', APP_TD ) ); register_nav_menu( 'theme_dashboard', __( 'User Dashboard', APP_TD ) ); } if ( ! function_exists( 'cp_header_menu_primary' ) ) : /** * Setup the primary header menu. * * @since 4.0.0 * * @param array $args Arguments to be used in wp_nav_menu(). */ function cp_header_menu_primary( $args = array() ) { $defaults = array( 'theme_location' => 'primary_top', 'container_class' => 'top-bar-right', 'container' => 'nav', 'menu_id' => 'menu-top-bar', 'menu_class' => 'menu medium-horizontal vertical', 'items_wrap' => '<ul id="%1$s" class="%2$s" data-responsive-menu="accordion medium-dropdown" data-close-on-click-inside="false">%3$s</ul>', 'fallback_cb' => false, 'depth' => 5, 'walker' => new CP_Topbar_Menu_Walker(), ); $args = wp_parse_args( $args, $defaults ); wp_nav_menu( $args ); } endif; if ( ! function_exists( 'cp_header_menu_secondary' ) ) : /** * Setup the secondary header menu. * * @since 4.0.0 */ function cp_header_menu_secondary() { wp_nav_menu( array( 'theme_location' => 'primary', 'container' => false, 'menu_id' => 'menu-header', 'menu_class' => 'menu medium-horizontal vertical', 'items_wrap' => '<ul id="%1$s" class="%2$s" data-responsive-menu="accordion medium-dropdown" data-close-on-click-inside="false">%3$s</ul>', 'fallback_cb' => false, 'depth' => 5, 'walker' => new CP_Topbar_Menu_Walker(), )); } endif; if ( ! function_exists( 'cp_footer_menu' ) ) : /** * Setup the footer menu. * * @since 4.0.0 */ function cp_footer_menu() { wp_nav_menu( array( 'theme_location' => 'secondary', 'container' => false, 'menu_id' => 'footer-nav-menu', 'menu_class' => 'social-media list-inline', 'fallback_cb' => false, 'depth' => 1, ) ); } endif; /** * Add additional login & register items to the primary header menu. * * @since 4.0.0 * * @todo Use actual menu pages instead of hardcoded items. * * @param string $items The HTML list content for the menu items. * @param object $args An object containing wp_nav_menu() arguments. */ function cp_header_menu_primary_top_items_login( $items, $args ) { if ( is_user_logged_in() || 'menu-top-bar' !== $args->menu_id ) { return $items; } $fields = array(); $output = ''; if ( get_option( 'users_can_register' ) ) { $fields['register'] = '<li id="menu-item-register"><a href="' . esc_url( wp_registration_url() ) . '" rel="nofollow" class="button hollow" id="register-button-link">' . __( 'Signup', APP_TD ) . '</a></li>'; } $fields['login'] = '<li id="menu-item-login"><a href="' . esc_url( wp_login_url( get_permalink() ) ) . '" rel="nofollow" class="button" id="login-button-link">' . __( 'Login', APP_TD ) . '</a></li>'; /** * Filters the default user login menu items. * * @since 4.0.0 * * @param array $fields The default user account fields. */ $fields = apply_filters( 'cp_header_menu_primary_top_items_login', $fields ); // Add the user login submenu items. foreach ( $fields as $field ) { $output .= $field; } return $items . $output; } add_filter( 'wp_nav_menu_items', 'cp_header_menu_primary_top_items_login', 10, 2 ); /** * Add user links to the primary top bar dropdown menu. * * Uses the wp_nav_menu_{$menu->slug}_items filter. * * @since 4.0.0 * * @todo Use actual menu pages instead of hardcoded items. * * @param string $items The HTML list content for the menu items. * @param object $args An object containing wp_nav_menu() arguments. */ function cp_header_menu_primary_top_user( $items, $args ) { $user_menu = ''; if ( is_user_logged_in() && 'menu-top-bar' === $args->menu_id ) { // Get the user object. $user = wp_get_current_user(); /** * Filter the display name next to the gravatar. * * @since 4.0.0 * * @param string $user->user_login The user login field. * @param array $user The user object. */ $display_name = apply_filters( 'cp_user_menu_display_name', $user->user_login, $user ); $avatar = get_avatar( $user->user_email, 30, '', '', array( 'class' => 'img-circle' ) ); // Need to build the menu wrapper so we can create the avatar dropdown. $user_menu = '<li id="menu-item-username" class="menu-item has-submenu"><a href="#" class="user-gravatar">' . $avatar . $display_name . '</a><ul id="menu-user" class="menu submenu vertical" data-submenu>'; // Get the user submenu items. $submenus = cp_header_menu_primary_top_items_user(); // Add the user submenu items. foreach ( $submenus as $submenu ) { $user_menu .= $submenu; } $user_menu .= '</ul></li>'; /** * Fires in the primary menu under the users' avatar dropdown. * * @since 4.0.0 * * @param string $user_menu The user menu dropdown list items. */ $user_menu = apply_filters( 'cp_header_menu_primary_top_user', $user_menu ); } return $items . $user_menu; } add_filter( 'wp_nav_menu_items', 'cp_header_menu_primary_top_user', 40, 2 ); /** * Filters the primary header nav menu so we can dynamically replace the * `{{user_account}}` title placeholder with the user gravatar. * * @todo Use this instead of cp_header_menu_primary_user() so user account menu * can be moved around via menus. Need to figure out best way to create logout * page and dynamically create other user account page menu items. * * @since 4.x.x * * @param string $item_output The menu item's starting HTML output. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param array $args An array of wp_nav_menu() arguments. * * @return string $item_output */ function cp_header_menu_primary_user_NEW( $item_output, $item, $depth, $args ) { $placeholder = '{{user_account}}'; if ( $placeholder != $item->title ) { return $item_output; } if ( is_user_logged_in() ) { $user = wp_get_current_user(); /** * Filter the display name next to the gravatar. * * @since 4.0.0 * * @param string $user->user_login The user login field. * @param array $user The user object. */ $display_name = apply_filters( 'cp_user_menu_display_name', $user->user_login, $user ); $avatar = get_avatar( $user->user_email, 30, '', '', array( 'class' => 'img-circle' ) ) . $display_name; $item_output = str_replace( $placeholder, $avatar, $item_output ); } return $item_output; } //add_filter( 'walker_nav_menu_start_el', 'cp_header_menu_primary_user_NEW', 10, 4 ); /** * Builds the logged in users drop-down menu items. * * @since 4.0.0 * * @return string */ function cp_header_menu_primary_top_items_user() { if ( ! is_user_logged_in() ) { return; } $fields = array( 'listings' => '<li id="menu-item-my-listings"><a href="' . esc_url( CP_DASHBOARD_URL ) . '" class="user-listings"><i class="fa fa-list" aria-hidden="true"></i>' . __( 'Listings', APP_TD ) . '</a></li>', 'profile' => '<li id="menu-item-edit-profile"><a href="' . esc_url( CP_PROFILE_URL ) . '" class="user-edit-profile"><i class="fa fa-user" aria-hidden="true"></i>' . __( 'Edit Profile', APP_TD ) . '</a></li>', 'divider' => '<li class="divider"></li>', 'logout' => '<li id="menu-item-logout"><a href="' . esc_url( wp_logout_url( get_permalink() ) ) . '" class="user-logout"><i class="fa fa-sign-out" aria-hidden="true"></i>' . __( 'Log out', APP_TD ) . '</a></li>', ); /** * Filters the default user account menu items. * * @since 4.0.0 * * @param array $fields The default user account fields. */ return apply_filters( 'cp_header_menu_primary_top_items_user', $fields ); } /** * Customize the output of menus for Foundation top bar * * @package ClassiPress * @since 4.0.0 */ class CP_Topbar_Menu_Walker extends Walker_Nav_Menu { /** * Starts the list before the elements are added. * * @see Walker_Nav_Menu::start_lvl() * * @since 4.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of page. Used for padding. * @param array $args Not used. */ function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat( "\t", $depth ); $output .= "\n$indent<ul class=\"vertical menu\">\n"; } } /** * Customize the output of menus for the Foundation mobile off-canvas menu * * @package ClassiPress * @since 4.0.0 */ class CP_Off_Canvas_Walker extends Walker_Nav_Menu { /** * Starts the list before the elements are added. * * @see Walker_Nav_Menu::start_lvl() * * @since 4.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of page. Used for padding. * @param array $args Not used. */ function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat( "\t", $depth ); $output .= "\n$indent<ul class=\"vertical menu\">\n"; } }