• Resolved younetdigitallife

    (@younetdigitallife)


    Hello , is it possible to move the “View all results” link from the end of the search table to the top of the search table? ( before the first search results item).

    Thank you in advance.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hello,

    Looks like I found the solution for you. Please use following code snippet

    add_action( 'wp_enqueue_scripts', 'aws_wp_enqueue_scripts', 999 );
    function aws_wp_enqueue_scripts() {
    
        $script = '
            function aws_results_html( html, options ) {
                var match = html.match(/<a class="aws_result_item aws_search_more"[.\s\S]*?<\/a>/gm);
                html = html.replace(/<a class="aws_result_item aws_search_more"[.\s\S]*?<\/a>/gm, "");
                html = html.replace(/(<a[.\s\S]*?<\/a>)/, match[0] + "$1");
                return html;
            }
            AwsHooks.add_filter( "aws_results_html", aws_results_html );
        ';
    
        wp_add_inline_script( 'aws-script', $script);
        wp_add_inline_script( 'aws-pro-script', $script);
    
    }

    You need to add it somewhere outside the plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets.

    Also after adding this code you will need to go to the plugin settings page and click the ‘Clear cache’ button.

    Regards

    Thread Starter younetdigitallife

    (@younetdigitallife)

    Hello , i tried the script and clear the cache , but now it seems the search bar is not working at all…

    The icon just keep spinning with no results.

    After inspecting , the error is the following

    Uncaught TypeError: Cannot read property '0' of null
        at aws_results_html ((index):3692)
        at common.js?ver=2.28:44
        at Array.forEach (<anonymous>)
        at common.js?ver=2.28:43
        at Array.forEach (<anonymous>)
        at Object.AwsHooks.apply_filters (common.js?ver=2.28:41)
        at Object.showResults (common.js?ver=2.28:266)
        at Object.success (common.js?ver=2.28:140)
        at c (jquery.min.js?ver=3.5.1:2)
        at Object.fireWith [as resolveWith] (jquery.min.js?ver=3.5.1:2)
    Plugin Author ILLID

    (@mihail-barinov)

    Please try this code instead

    add_action( 'wp_enqueue_scripts', 'aws_wp_enqueue_scripts', 999 );
    function aws_wp_enqueue_scripts() {
    
        $script = '
            function aws_results_html( html, options ) {
                var match = html.match(/<a class="aws_result_item aws_search_more"[.\s\S]*?<\/a>/gm);
                if ( match && typeof match[0] === "string" ) {
                    html = html.replace(/<a class="aws_result_item aws_search_more"[.\s\S]*?<\/a>/gm, "");
                    html = html.replace(/(<a[.\s\S]*?<\/a>)/, match[0] + "$1");
                }
                return html;
            }
            AwsHooks.add_filter( "aws_results_html", aws_results_html );
        ';
    
        wp_add_inline_script( 'aws-script', $script);
        wp_add_inline_script( 'aws-pro-script', $script);
    
    }
    Thread Starter younetdigitallife

    (@younetdigitallife)

    Results are now showing but nothing is changed.. The “View all Results” button is still at the bottom of the search results.

    Plugin Author ILLID

    (@mihail-barinov)

    Ok, than please try this code instead

    add_action( 'wp_enqueue_scripts', 'aws_wp_enqueue_scripts', 999 );
    function aws_wp_enqueue_scripts() {
    
        $script = '
            function aws_results_html( html, options ) {
                var match = html.match(/<li class="aws_result_item aws_search_more"[.\s\S]*?<\/li>/gm);
                if ( match && typeof match[0] === "string" ) {
                    html = html.replace(/<li class="aws_result_item aws_search_more"[.\s\S]*?<\/li>/gm, "");
                    html = html.replace(/(<li[.\s\S]*?<\/li>)/, match[0] + "$1");
                }
                return html;
            }
            AwsHooks.add_filter( "aws_results_html", aws_results_html );
        ';
    
        wp_add_inline_script( 'aws-script', $script);
        wp_add_inline_script( 'aws-pro-script', $script);
    
    }
    Thread Starter younetdigitallife

    (@younetdigitallife)

    That worked !! Thank you for your help!

    Thread Starter younetdigitallife

    (@younetdigitallife)

    I just purchased the premium version and the snippet is not working… Maybe i need to change something in the script?

    Thank you in advance.

    Thread Starter younetdigitallife

    (@younetdigitallife)

    I used this script and worked ( the previous one).

    add_action( 'wp_enqueue_scripts', 'aws_wp_enqueue_scripts', 999 );
    function aws_wp_enqueue_scripts() {
    
        $script = '
            function aws_results_html( html, options ) {
                var match = html.match(/<a class="aws_result_item aws_search_more"[.\s\S]*?<\/a>/gm);
                if ( match && typeof match[0] === "string" ) {
                    html = html.replace(/<a class="aws_result_item aws_search_more"[.\s\S]*?<\/a>/gm, "");
                    html = html.replace(/(<a[.\s\S]*?<\/a>)/, match[0] + "$1");
                }
                return html;
            }
            AwsHooks.add_filter( "aws_results_html", aws_results_html );
        ';
    
        wp_add_inline_script( 'aws-script', $script);
        wp_add_inline_script( 'aws-pro-script', $script);

    Hola.
    También tengo la versión premium, y estoy mirando la forma de poner arriba la opción:
    ” ver todos los resultados” He seguido vuestro hilo…pero después de incluir el código, la opción sique abajo. Lo único que cambia es que en el buscador a la izq. aparece un filtro con el botón ALL. Pero igualmente no hace nada.

    Si pudieran dar una solución.

    Gracias
    Un saludo

    Plugin Author ILLID

    (@mihail-barinov)

    @ameliacch

    Please try to add following code snippet:

    add_action( 'wp_enqueue_scripts', 'aws_wp_enqueue_scripts', 999 );
    function aws_wp_enqueue_scripts()
    {
    
        $script = '
            function aws_results_html( html, options ) {
                var match = html.match(/<a class="aws_result_item aws_search_more"[.\s\S]*?<\/a>/gm);
                if ( match && typeof match[0] === "string" ) {
                    html = html.replace(/<a class="aws_result_item aws_search_more"[.\s\S]*?<\/a>/gm, "");
                    html = html.replace(/(<a[.\s\S]*?<\/a>)/, match[0] + "$1");
                }
                return html;
            }
            AwsHooks.add_filter( "aws_results_html", aws_results_html );
        ';
    
        wp_add_inline_script('aws-script', $script);
        wp_add_inline_script('aws-pro-script', $script);
    }

    Don’t forget to clear browser cache and any caching plugins cache after adding that code.

    Regards

    GRACIAS!!
    Ahora si que ha funcionado. El otro día use el mismo código. Quizá se me pasó refrescar la caché.

    Un saludo

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘View All Results – Move to Top’ is closed to new replies.