-
AuthorPosts
-
May 6, 2014 at 3:31 pm #260764
Hi,
Where can I change the default text in the search ‘drop down’?
I would like to change “posts” to “news” and “portfolio items” to “products”May 7, 2014 at 4:36 am #261075Hey t3lgroup!
Thank you for using the theme!
Please add this on functions.php to change the label names.
add_filter('avf_ajax_search_label_names','avf_ajax_search_assign_label_names', 10, 1); function avf_ajax_search_assign_label_names($label) { if($label == 'Portfolio Items') { $label = 'Products'; } else if($label == 'Posts') { $label = 'News'; } else { $label = $label; } return $label; }
You can add more conditions for different label names and you can find the hook on functions-enfold.php, line 152:
$label = apply_filters('avf_ajax_search_label_names', $post_type_obj[$key]->labels->name);
Best regards,
IsmaelMay 7, 2014 at 9:14 am #261200Hi Ismael,
Thanks for reply. I have just tried to copy/paste the above code into functions.php but after doing that my site was completely black; front and backend.
1: i have pasted the code into functions.php file located here: /wp-content/themes/enfold/functions.php is this the correct file?
2: i just pasted the code in the very end of the file. Is this correct or do it need to placed a specific place in the file?I am not very familiar with this kind of code. When i pasted the code in it was highlighted with som ‘red’ fields (errors)
May 7, 2014 at 11:37 am #261246Hi!
Please copy/paste the code Ismael posted directly to the bottom of functions.php file. I checked it and it is working fine on my end – http://i.imgur.com/vAJPztk.png
Cheers!
YigitMay 7, 2014 at 11:50 am #261258Yeah, now it also worked for me! Great!
When making a search and you hit ‘enter’ there is a list of search resuslts. Is it possible to have images next to these results? Like there are in the drop down?
May 7, 2014 at 11:56 am #261265Hey!
Please see Ismael’s post here – https://kriesi.at/support/topic/add-featured-image-to-search-results/#post-249161
Best regards,
YigitMay 7, 2014 at 12:10 pm #261270Super. Worked too! :)
What happens when there is an update to the enfold theme? Will this overwrite/remove the code I have inserted in ‘functions.php’ and ‘loop-search.php’ so I need to paste it in each time the theme is updated?
May 7, 2014 at 12:23 pm #261273Hey!
You can add the code to functions.php of your child theme and move loop-search.php file inside includes folder you created in child theme
Best regards,
YigitMay 7, 2014 at 12:26 pm #261275Hmm, that I don’t know much about. I don’t think I have a ‘child-theme’. Is it to late to have/do that when having created the entire website?
May 7, 2014 at 12:27 pm #261277Hey!
You can import parent theme settings. For more information, please see – http://kriesi.at/documentation/enfold/using-a-child-theme/
Regards,
Yigit -
AuthorPosts
- You must be logged in to reply to this topic.