/
www
/
wwwroot
/
fxdst.com
/
wp-content
/
themes
/
fxdst
/
templates
/
Upload File
HOME
<?php /* * @Theme Name:WebStack * @Theme URI:https://www.iotheme.cn/ * @Author: iowen * @Author URI: https://www.iowen.cn/ * @Date: 2019-02-22 21:26:02 * @LastEditors: iowen * @LastEditTime: 2024-07-30 22:18:36 * @FilePath: /WebStack/templates/header-nav.php * @Description: */ if ( ! defined( 'ABSPATH' ) ) { exit; } if (!function_exists('fxdst_get_term_children_sorted')) { function fxdst_get_term_children_sorted($parent_id) { return get_categories(array( 'taxonomy' => 'favorites', 'parent' => (int) $parent_id, 'meta_key' => '_term_order', 'orderby' => 'meta_value_num', 'order' => 'desc', 'hide_empty' => 0, )); } } $categories = get_categories( array( 'taxonomy' => 'favorites', 'parent' => 0, 'meta_key' => '_term_order', 'orderby' => 'meta_value_num', 'order' => 'desc', 'hide_empty' => 0, )); $fxdst_sidebar_slugs = array( 'ai-development', 'ai-coding', 'ai-models', 'build-deploy', 'monetization-payments', 'saas-ops', 'growth-marketing', 'data-analytics', 'design-content', 'automation-tools', 'community-resources', ); $categories = array_values(array_filter($categories, function($category) use ($fxdst_sidebar_slugs) { return in_array($category->slug, $fxdst_sidebar_slugs, true); })); $fxdst_nav_is_front = is_front_page(); $fxdst_nav_anchor_prefix = $fxdst_nav_is_front ? '' : trailingslashit(home_url()); $fxdst_nav_anchor_class = $fxdst_nav_is_front ? ' class="smooth"' : ''; ?> <div class="sidebar-menu toggle-others fixed"> <div class="sidebar-menu-inner"> <header class="logo-env"> <!-- logo --> <div class="logo"> <a href="<?php bloginfo('url') ?>" class="logo-expanded" aria-label="<?php echo esc_attr__('方向舵全球科技工具导航', 'i_theme'); ?>"> <img class="fxdst-brand-mark" src="<?php echo esc_url(io_get_option('logo_small')) ?>" width="52" height="52" alt="" aria-hidden="true" /> <span class="fxdst-brand-copy"><strong>方向舵</strong><small>全球科技工具导航</small></span> </a> <a href="<?php bloginfo('url') ?>" class="logo-collapsed"> <img src="<?php echo io_get_option('logo_small') ?>" height="40" alt="<?php bloginfo('name') ?>"> </a> </div> <div class="mobile-menu-toggle visible-xs"> <a href="#" data-toggle="mobile-menu"> <i class="fa fa-bars"></i> </a> </div> </header> <ul id="main-menu" class="main-menu"> <?php foreach($categories as $category) { $_visible = io_is_visible(get_term_meta($category->term_id, '_view_user', true)); if ($_visible === 0) { continue; } $children = fxdst_get_term_children_sorted($category->term_id); if(empty($children)){ ?> <li> <a href="<?php echo esc_url($fxdst_nav_anchor_prefix . '#term-' . $category->term_id); ?>"<?php echo $fxdst_nav_anchor_class; ?>> <i class="<?php echo get_term_meta($category->term_id, '_term_ico',true) ?> fa-fw"></i> <span class="title"><?php echo $category->name; ?></span> </a> </li> <?php }else { ?> <li> <a href="<?php echo esc_url($fxdst_nav_anchor_prefix . '#term-' . $category->term_id); ?>"<?php echo $fxdst_nav_anchor_class; ?>> <i class="<?php echo get_term_meta($category->term_id, '_term_ico',true) ?> fa-fw"></i> <span class="title"><?php echo $category->name; ?></span> </a> <ul> <?php foreach ($children as $mid) { $_visible = io_is_visible(get_term_meta($mid->term_id, '_view_user', true)); if ($_visible === 0) { continue; } $grandchildren = fxdst_get_term_children_sorted($mid->term_id); ?> <li> <a href="<?php echo esc_url($fxdst_nav_anchor_prefix . '#term-' . $mid->term_id); ?>"<?php echo $fxdst_nav_anchor_class; ?>><?php echo $mid->name; ?></a> </li> <?php if (!empty($grandchildren)) : ?> <?php foreach ($grandchildren as $leaf) : $_leaf_visible = io_is_visible(get_term_meta($leaf->term_id, '_view_user', true)); if ($_leaf_visible === 0) { continue; } ?> <li class="menu-item-third-level"> <a href="<?php echo esc_url($fxdst_nav_anchor_prefix . '#term-' . $leaf->term_id); ?>"<?php echo $fxdst_nav_anchor_class; ?>><?php echo $leaf->name; ?></a> </li> <?php endforeach; ?> <?php endif; ?> <?php } ?> </ul> </li> <?php } } ?> <?php $fxdst_contact_page = get_page_by_path('contact-us'); if ($fxdst_contact_page) : ?> <li class="submit-tag fxdst-sidebar-service-link"> <a href="<?php echo esc_url(get_permalink($fxdst_contact_page)); ?>"> <i class="fa fa-envelope-o fa-fw"></i> <span class="title"><?php echo esc_html(get_the_title($fxdst_contact_page)); ?></span> </a> </li> <?php endif; ?> <?php $fxdst_partners_page = get_page_by_path('partners'); $fxdst_partners_url = $fxdst_partners_page ? get_permalink($fxdst_partners_page) : home_url('/partners'); ?> <li class="submit-tag fxdst-sidebar-service-link"> <a href="<?php echo esc_url($fxdst_partners_url); ?>"> <i class="fa fa-handshake-o fa-fw"></i> <span class="title">合作伙伴</span> </a> </li> <?php $fxdst_blog_page = get_page_by_path('blog'); $fxdst_blog_url = $fxdst_blog_page ? get_permalink($fxdst_blog_page) : home_url('/blog'); ?> <li class="submit-tag fxdst-sidebar-service-link"> <a href="<?php echo esc_url($fxdst_blog_url); ?>"> <i class="fa fa-newspaper-o fa-fw"></i> <span class="title">博客文章</span> </a> </li> </ul> </div> </div>