Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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”

    #261075

    Hey 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,
    Ismael

    #261200

    Hi 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)

    #261246

    Hi!

    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!
    Yigit

    #261258

    Yeah, 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?

    #261265

    Hey!

    Please see Ismael’s post here – https://kriesi.at/support/topic/add-featured-image-to-search-results/#post-249161

    Best regards,
    Yigit

    #261270

    Super. 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?

    #261273

    Hey!

    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,
    Yigit

    #261275

    Hmm, 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?

    #261277

    Hey!

    You can import parent theme settings. For more information, please see – http://kriesi.at/documentation/enfold/using-a-child-theme/
    Regards,
    Yigit

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