Changeset 3474225
- Timestamp:
- 03/04/2026 06:48:01 AM (4 weeks ago)
- Location:
- infility-global/trunk
- Files:
-
- 4 edited
-
infility_global.php (modified) (2 diffs)
-
widgets/elementor-tab/elementor-tab.php (modified) (2 diffs)
-
widgets/elementor-tab/includes/widgets/elementor_nav_posts.php (modified) (1 diff)
-
widgets/elementor-tab/js/elementor_nav_posts.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
infility-global/trunk/infility_global.php
r3474222 r3474225 4 4 Plugin URI: https://www.infility.cn/ 5 5 Description: Infility公共插件 6 Version: 2.14.5 56 Version: 2.14.56 7 7 Author: Infility 8 8 Author URI: https://www.infility.cn/ … … 147 147 function __construct() 148 148 { 149 define( 'INFILITY_GLOBAL_VERSION', '2.14.5 5' );149 define( 'INFILITY_GLOBAL_VERSION', '2.14.56' ); 150 150 define( 'INFILITY_GLOBAL_PATH', plugin_dir_path( __FILE__ ) ); // fullpath/wp-content/plugins/infility-global/ // 有斜杠 151 151 define( 'INFILITY_GLOBAL_URL', plugins_url( '/', __FILE__ ) ); // https://the_domain/wp-content/plugins/infility-global/ // 斜杠是自己加的 -
infility-global/trunk/widgets/elementor-tab/elementor-tab.php
r3474222 r3474225 314 314 315 315 $is_curr_post = isset($_POST['is_curr_post']) ? sanitize_text_field($_POST['is_curr_post']) : 'no'; 316 $show_all_categories = isset($_POST['show_all_categories']) ? sanitize_text_field($_POST['show_all_categories']) : 'yes'; 316 317 $current_post_id = isset($_POST['current_post_id']) ? intval($_POST['current_post_id']) : 0; 317 318 $current_term_id = isset($_POST['current_term_id']) ? intval($_POST['current_term_id']) : 0; … … 375 376 } 376 377 } 377 } elseif ($ is_curr_post === 'yes') {378 } elseif ($show_all_categories === 'no' && $is_curr_post === 'yes') { 378 379 // Category is 'all', but we want to filter by current context 379 380 $current_category_id = 0; -
infility-global/trunk/widgets/elementor-tab/includes/widgets/elementor_nav_posts.php
r3474222 r3474225 1099 1099 show_all_categories: '<?php echo esc_js($settings['show_all_categories']); ?>', 1100 1100 current_post_id: '<?php echo get_the_ID(); ?>', 1101 current_term_id: '<?php echo (is_category() || is_tax() || is_tag()) ? get_queried_object_id() : ""; ?>' 1101 current_term_id: '<?php echo (is_category() || is_tax() || is_tag()) ? get_queried_object_id() : ""; ?>', 1102 default_active_term_id: '<?php 1103 $default_active_term_id = ""; 1104 if (is_category() || is_tax() || is_tag()) { 1105 $default_active_term_id = get_queried_object_id(); 1106 } elseif (is_single()) { 1107 $post_type = $settings['post_type']; 1108 $taxonomy = $settings['taxonomy_type']; 1109 if ("custom_taxonomy" === $taxonomy) { 1110 $taxonomy = $settings['custom_taxonomy']; 1111 } 1112 if (empty($taxonomy)) { 1113 $taxonomies = get_object_taxonomies($post_type); 1114 if (!empty($taxonomies)) { 1115 $taxonomy = $taxonomies[0]; 1116 } 1117 } 1118 if (!empty($taxonomy)) { 1119 $terms = get_the_terms(get_the_ID(), $taxonomy); 1120 if ($terms && !is_wp_error($terms)) { 1121 $default_active_term_id = $terms[0]->term_id; 1122 } 1123 } 1124 } 1125 echo $default_active_term_id; 1126 ?>' 1102 1127 }; 1103 1128 -
infility-global/trunk/widgets/elementor-tab/js/elementor_nav_posts.js
r3474222 r3474225 550 550 // 重新绑定分类点击事件 551 551 bindCategoryEvents(); 552 553 // 处理默认选中状态 554 if (settings.is_curr_post === 'yes' && settings.default_active_term_id) { 555 var $activeItem = $('.nav-item[data-category="' + settings.default_active_term_id + '"], .nav-sub-item[data-category="' + settings.default_active_term_id + '"]'); 556 if ($activeItem.length > 0) { 557 $('.nav-item, .nav-sub-item').removeClass('active'); 558 559 // 如果是子项,确保父项展开 560 var $parentItem = $activeItem.closest('.nav-item'); 561 if ($parentItem.hasClass('has-children')) { 562 $parentItem.addClass('expanded'); 563 $parentItem.find('.nav-sub-list').addClass('show'); 564 // $parentItem.addClass('active'); // 父项也要 active 吗?通常不需要,只高亮子项 565 } 566 567 // 如果 activeItem 是父项本身,或者是没有子项的一级分类 568 if ($activeItem.hasClass('nav-item')) { 569 $activeItem.addClass('active'); 570 } else { 571 $activeItem.addClass('active'); 572 // $parentItem.addClass('active'); // 也可以高亮父项 573 } 574 } 575 } 552 576 }, 553 577 error: function() { … … 557 581 }); 558 582 559 filterPostsByCategory(); 583 if (settings.is_curr_post === 'yes' && settings.default_active_term_id) { 584 filterPostsByCategory(settings.default_active_term_id); 585 } else { 586 filterPostsByCategory(); 587 } 560 588 561 589 // 绑定分页点击事件
Note: See TracChangeset
for help on using the changeset viewer.