Forums › Forums › Search & Filter Pro › Rename Posts to News in front end dropdown?
- This topic has 5 replies, 2 voices, and was last updated 5 years, 3 months ago by Trevor.
Viewing 6 posts - 1 through 6 (of 6 total)
-
Anonymous(Private) September 5, 2019 at 11:04 am #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
NickTrevor(Private) September 5, 2019 at 4:07 pm #220360It is, using a filter:
https://searchandfilter.com/documentation/action-filter-reference/#filter-input-object
Trevor(Private) September 18, 2019 at 3:34 pm #221251function 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. -
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)