Plugin Directory

Changeset 3103729


Ignore:
Timestamp:
06/17/2024 07:22:55 PM (22 months ago)
Author:
5um17
Message:

Fixed issue with WP Query Loop block

Location:
wp-extended-search/trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • wp-extended-search/trunk/includes/admin/class-wpes-admin.php

    r2843917 r3103729  
    149149        if ( 'toplevel_page_wp-es' === $hook ) {
    150150            wp_enqueue_script( 'jquery-ui-datepicker' );
    151             wp_enqueue_script( 'wpes_select2_js', 'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js' );
     151            wp_enqueue_script( 'wpes_select2_js', WPES_ASSETS_URL . 'js/select2.min.js' );
    152152            wp_enqueue_script( 'wpes_admin_js', WPES_ASSETS_URL . 'js/wp-es-admin.js', array( 'jquery-ui-datepicker', 'wpes_select2_js' ) );
    153153            wp_enqueue_style( 'wpes_jquery_ui', WPES_ASSETS_URL . 'css/jQueryUI/jquery-ui.min.css' );
    154154            wp_enqueue_style( 'wpes_jquery_ui_theme', WPES_ASSETS_URL . 'css/jQueryUI/jquery-ui.theme.min.css' );
    155             wp_enqueue_style( 'wpes_select2_css', 'https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css' );
     155            wp_enqueue_style( 'wpes_select2_css', WPES_ASSETS_URL . 'css/select2.min.css' );
    156156            wp_enqueue_style( 'wpes_admin_css', WPES_ASSETS_URL . 'css/wp-es-admin.css', array( 'wpes_jquery_ui', 'wpes_jquery_ui_theme', 'wpes_select2_css' ) );
    157157
  • wp-extended-search/trunk/includes/class-wpes-core.php

    r2843917 r3103729  
    267267        add_action( 'pre_get_posts', array( $this, 'wp_es_pre_get_posts' ), 500 );
    268268
     269        // Add additional hooks for compatibility with core and plugins/themes.
     270        $this->add_additional_compatibility_hooks();
     271
    269272        // Call the init function so wpes_enabled filter can work.
    270273        if ( ! empty( $this->wpes_wc ) ) {
     
    464467
    465468        // Request distinct results.
    466         add_filter( 'posts_distinct_request', array( $this, 'wp_es_distinct' ) );
     469        add_filter(
     470            'posts_distinct_request',
     471            function() {
     472                return 'DISTINCT';
     473            }
     474        );
    467475
    468476        /**
     
    499507        }
    500508
    501         // Joint the users table.
     509        // Join the users table.
    502510        if ( ! empty( $this->wpes_settings['authors'] ) ) {
    503511            $join .= " LEFT JOIN $wpdb->users esusers ON ($wpdb->posts.post_author = esusers.ID) ";
     
    505513
    506514        return $join;
    507     }
    508 
    509     /**
    510      * Request distinct results.
    511      *
    512      * @since 1.0
    513      * @param string $distinct DISTINCT Keyword.
    514      * @return string $distinct
    515      */
    516     public function wp_es_distinct( $distinct ) {
    517         $distinct = 'DISTINCT';
    518         return $distinct;
    519515    }
    520516
     
    604600        return false;
    605601    }
     602
     603    /**
     604     * Add additional hooks for compatibility with core and plugins/themes.
     605     *
     606     * @since dev
     607     * @return void
     608     */
     609    public function add_additional_compatibility_hooks() {
     610        // Disable WPES for Query Loop block when "Inherit query from template" is disabled.
     611        add_action(
     612            'query_loop_block_query_vars',
     613            function( $query, $block ) {
     614                if ( empty( $block->context['query']['inherit'] ) ) {
     615                    $query['disable_wpes'] = true;
     616                }
     617
     618                return $query;
     619            },
     620            10,
     621            2
     622        );
     623    }
    606624}
  • wp-extended-search/trunk/languages/wp-extended-search.pot

    r3069790 r3103729  
    66"Report-Msgid-Bugs-To: "
    77"https://wordpress.org/support/plugin/wp-extended-search\n"
    8 "POT-Creation-Date: 2024-04-12 21:24:52+00:00\n"
     8"POT-Creation-Date: 2024-06-17 19:16:43+00:00\n"
    99"MIME-Version: 1.0\n"
    1010"Content-Type: text/plain; charset=utf-8\n"
Note: See TracChangeset for help on using the changeset viewer.