Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1216592

    What code can I place in my functions file to arrange my ajax search dropdown results by either ascending or descending order?

    I need it exactly opposite of what it is now :D

    Thank you

    #1218803

    Hey MrPoBoi,

    Sorry for the delay. You can use the avf_ajax_search_query filter to adjust the query of the ajax search. Usage examples can be found in the following threads.

    // https://kriesi.at/support/topic/bad-search-results/#post-1128923
    // https://kriesi.at/support/topic/private-post-made-public-after-update/#post-1116846

    You need to add the order and orderby parameter in the query.

    Best regards,
    Ismael

    #1218811

    Hello Ismael,

    Thank you for the response, as any response is better than no response :D

    anyways, I visited the links you shared, I still do not know what I am supposed to place in my functions file.

    But on this page:
    https://wordpress.stackexchange.com/questions/278056/order-by-the-results-of-a-function-with-wp-query

    they mention something about the use of these tags

    
       'post_parent'    => $post->ID,
       'post_type'      => 'page',
       'posts_per_page' => 8,
       'paged'          => get_query_var( 'paged' ),
       'meta_key'       => 'team_school',
       'meta_value'     => $school_type,
       'orderby'        => 'wpse_last_word', //<-- make filter for ordering!
       'order'          => 'ASC'
    
    

    Also, in this post that got closed out early:

    https://kriesi.at/support/topic/instagram-as-a-shortcode/

    I would like the image in the widget itself to go from displaying 3 images on desktop to only displaying 1 full size image on mobile

    Currently it always shows the selection chosen for the widget options, meaning it is not responsive in regards to the column size

    Thank you for your time and work on this great theme…

    no matter how many other themes I try to work with and use for a project… I always end up coming back to enfold. It truly is one of, if not thee greatest theme out there

    Only because the staff our continuously keeping up with updates and changes, you guys are great, thank you!

    #1219065

    Hi,

    Thank you for the update and for the kind words.

    You can try this snippet in the functions.php file to adjust the default ajax search query.

    add_filter('avf_ajax_search_query', 'avf_modify_ajax_search_query', 10, 1);
    function avf_modify_ajax_search_query($search_parameters)
    {
        parse_str($search_parameters, $params);
        $params['orderby'] = 'post_date';
        $params['order'] = 'ASC'; // default is DESC
        $search_parameters = http_build_query($params);
        return $search_parameters;
    }

    We just changed the order from DESC to ASC.

    // https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameter

    Best regards,
    Ismael

    #1219215

    Hello Ismael,

    I was really excited to see the code this morning, but I must apologize for taking up so much of your time with this.

    I placed this code in my functions file and I get the fatal error message of “There has been a critical error on your website.”

    and the website “crashes”

    However, I tried to tinker with the code, but I have no idea how to decipher it in depth.

    So as far as I got with troubleshooting was removing the add filter and the function

    When I leave the add filter the website is fine

    when I place in the functions code, the site crashes.

    I even removed the code of the functions part and just pasted in the below code which still crashed my site

    
    function avf_modify_ajax_search_query($search_parameters)
    {
    
    }
    

    I am running on PHP 7.3 I am not sure if that matters or not… and once again, thank you for everything!

    #1220369

    Hi,

    It is working properly on our end — we don’t get any error. Did you copy the code from your email? Please try to copy it directly from the forum to avoid conversion of symbols to something else, which is what probably caused the snippet to break. If it’s still not working after, please post the login details in the private field so that we can see what’s going on.

    Best regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.