Plugin Directory

Changeset 3474225


Ignore:
Timestamp:
03/04/2026 06:48:01 AM (4 weeks ago)
Author:
infility
Message:

v2.14.56 (20260304) Ben: 优化ele组件

Location:
infility-global/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • infility-global/trunk/infility_global.php

    r3474222 r3474225  
    44Plugin URI: https://www.infility.cn/
    55Description: Infility公共插件
    6 Version: 2.14.55
     6Version: 2.14.56
    77Author: Infility
    88Author URI: https://www.infility.cn/
     
    147147    function __construct()
    148148    {
    149         define( 'INFILITY_GLOBAL_VERSION', '2.14.55' );
     149        define( 'INFILITY_GLOBAL_VERSION', '2.14.56' );
    150150        define( 'INFILITY_GLOBAL_PATH', plugin_dir_path( __FILE__ ) ); // fullpath/wp-content/plugins/infility-global/ // 有斜杠
    151151        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  
    314314       
    315315        $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';
    316317        $current_post_id = isset($_POST['current_post_id']) ? intval($_POST['current_post_id']) : 0;
    317318        $current_term_id = isset($_POST['current_term_id']) ? intval($_POST['current_term_id']) : 0;
     
    375376                }
    376377            }
    377         } elseif ($is_curr_post === 'yes') {
     378        } elseif ($show_all_categories === 'no' && $is_curr_post === 'yes') {
    378379             // Category is 'all', but we want to filter by current context
    379380             $current_category_id = 0;
  • infility-global/trunk/widgets/elementor-tab/includes/widgets/elementor_nav_posts.php

    r3474222 r3474225  
    10991099                    show_all_categories: '<?php echo esc_js($settings['show_all_categories']); ?>',
    11001100                    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                    ?>'
    11021127                };
    11031128
  • infility-global/trunk/widgets/elementor-tab/js/elementor_nav_posts.js

    r3474222 r3474225  
    550550                // 重新绑定分类点击事件
    551551                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                }
    552576            },
    553577            error: function() {
     
    557581        });
    558582
    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        }
    560588
    561589        // 绑定分页点击事件
Note: See TracChangeset for help on using the changeset viewer.