Tagged: ,

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #174502

    I have seen that in the forum you are using the ajax search button (not the search, but the same appearance). How I can implented?

    Thank you.

    #174554

    Hi Pedro!

    I marked this thread for Kriesi – I’m sure he already created some custom code for his child theme.

    Best regards,
    Peter

    #175002

    Hi, I am using this filter function in my child themes functions.php file:

    add_action('avf_frontend_search_form_param', 'kriesi_forum_search',9);
    
    function kriesi_forum_search($params)
    {
    	if( strpos($_SERVER["REQUEST_URI"], 'forums') !== false )
    	{
    		$params['ajax_disable'] = true;
    		$params['search_id'] = "bbp_search";
    		$params['placeholder'] = "Search Forums";
    	}
    	
    	return $params;
    }
    

    The if( strpos($_SERVER["REQUEST_URI"], 'forums') !== false ) checks if the url contains the word “forums” and if thats the case changes the search to a bbpress search. might be necessary for you to check for another keyword (for example “forum” ) or omit the check to activate it globaly…

    Regards,
    Kriesi

    • This reply was modified 11 years, 1 month ago by Kriesi.
    #175654

    Thanks Kriesi, but is not working in my case. I have the keyword “forums”, I change it, and is not changing at all.

    This is the code that I type:

    add_action('avf_frontend_search_form_param', 'kriesi_forum_search',9);
    
    function kriesi_forum_search($params)
    {
    	if( strpos($params['form_action'], 'forums') !== false )
    	{
    		$params['ajax_disable'] = true;
    		$params['search_id'] = "bbp_search";
    		$params['placeholder'] = "Search Forums";
    	}
    	
    	return $params;
    }
    #175655
    This reply has been marked as private.
    #175679

    Hey!

    Please try to use

    if( strpos($_SERVER["REQUEST_URI"], 'forums') !== false )
    

    instead

    #175681

    Now! Why could be the reason that before didn’t work?

    Thank you anyways :)

    #175683

    Was my mistake, the fact that I run a pretty heavy customized theme version that is different in a few ways from a default installation prevented it from working for you ;)

    Glad it works!
    Cheers

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Ajax search button in forums’ is closed to new replies.