Tagged: 

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

    I have a gallery of hundreds of photos by different artists and I need to be able to have the user search them by artist name, which I planned to place in the caption for each image in the masonry tile portfolio. But the captions don’t appear to be searchable, because when I put in the artist name that I entered in the caption, nothing comes up (using the search bar in the header). Do you have a fix for this?

    #214696

    Hey auroradesignstudio!

    No, the search function is the default WordPress search. There isn’t anything we can do on our end to change it.

    I know some plugins exist to improve it like SearchWP but I don’t know if they will search a caption or not.

    Cheers!
    Devin

    #214925

    Thanks, Devin,
    I did get SearchWP and it does search the captions in the masonry gallery (yeah!) however, it’s behaving a bit strangely.
    I saw another post with some php code that is supposed to be used with the theme when implementing Relevanssi, but the post doesn’t say where I would enter that code. Can you help?
    Lynda

    #214955

    Hi!

    You can add this code on functions.php:

    add_filter('avf_ajax_search_function', 'avia_init_relevanssi', 10, 4);
    function avia_init_relevanssi($function_name, $search_query, $search_parameters, $defaults)
    {
        $function_name = 'avia_relevanssi_search';
        return $function_name;
    }
    
    function avia_relevanssi_search($search_query, $search_parameters, $defaults)
    {
        global $query;
        $tempquery = $query;
        if(empty($tempquery)) $tempquery = new WP_Query();
    
        $tempquery->query_vars = $search_parameters;
        relevanssi_do_query($tempquery);
        $posts = $tempquery->posts;
    
        return $posts;
    }

    Best regards,
    Ismael

    #215479

    Ismael:
    When I tried to add this code I got an error message that said there was a syntax error in this line:
    function avia_init_relevanssi($function_name, $search_query, $search_parameters, $defaults)
    I don’t know enough about php to fix it. ?

    Lynda

    #215881

    Hi!

    Where are you adding it in? I checked the main docs and its the same function: http://www.kriesi.at/documentation/enfold/use-relevanssi-in-search-instead-of-the-default-search/

    Checking it now and not getting an error so it may just be the placement in your functions.php file. Try adding it at the very end of the file just after the last line.

    Regards,
    Devin

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.