Forums Forums Search & Filter Pro Rename Posts to News in front end dropdown?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Anonymous
    #220331

    Hi,

    we are using the plugin on our site and the frontend has a dropdown showing the post types which are:

    • Posts
    • Pages
    • Courses
    • Events

    We need to rename Posts to News (just the display), I am fine with the URL still saying: &post_types=post

    Is this possible to do?

    Thanks
    Nick

    Trevor
    #220360
    Anonymous
    #221207

    Hi Trevor,

    Thanks for the link I am a bit confused about what I need to put here:

    //udpate this field before rendering

    Is it as simple as:
    $option->label = “News”;

    Thanks
    Nick

    Trevor
    #221251
    function filter_input_object($input_object, $sfid)
    {
    	if($input_object['name']!='_sf_post_type')
    	{
    		return $input_object;
    	}
    
    	if(!isset($input_object['options']))
    	{
    		return $input_object;
    	}
    	
    	foreach($input_object['options'] as $option)
    	{
    		if($option->value=="post")
    		{
    			$option->label = "News";
    		}
    	}
    	
    	return $input_object;
    }
    add_filter('sf_input_object_pre', 'filter_input_object', 10, 2);

    Something like this, but in the first like change the $sfid for the actual ID number of the form. This code goes in the child theme functions.php file. I think I have it correct.

    Anonymous
    #221321

    Hi Trevor

    Thanks that worked perfectly.

    Thanks
    Nick

    Trevor
    #221324

    Great. Thanks for letting me know.

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