Tagged: search
-
AuthorPosts
-
January 25, 2014 at 12:42 am #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?
January 25, 2014 at 3:50 am #214696Hey 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!
DevinJanuary 26, 2014 at 1:11 am #214925Thanks, 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?
LyndaJanuary 26, 2014 at 4:23 am #214955Hi!
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,
IsmaelJanuary 27, 2014 at 8:18 pm #215479Ismael:
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
January 28, 2014 at 5:00 pm #215881Hi!
Where are you adding it in? I checked the main docs and its the same function: http://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 -
AuthorPosts
- The topic ‘Searching captions in portfolios or galleries’ is closed to new replies.