Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Possible to change Post type Name in filter?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Daniel Slade
    #232075

    We have two post types that we are using in the filter: Articles (posts) and Podcasts.
    We have two requests/issues.
    The first issue is that we renamed the normal wordpress posts to Articles. Just a decision to make it easier for our authors and readers. We have it changed everywhere on the site (wp-admin and front end), but S&F pro plugin is still bringing it up as ‘posts’…

    Second issue is we use a podcast plugin for our podcasts, but that plugin writes the cpt as ‘podcast’ and we want the filter to show it as ‘podcasts’ (plural).

    So we have both those post types as checkboxes on the filter/search.
    Is is possible to modify those values on the form itself? Since we can’t change the podcast CPT details – its just built in, and the ‘posts’ everywhere but this plugin show as ‘Articles’.

    thoughts??

    Trevor Moderator
    #232078

    If you mean by this the terms showing in the form fields, it might be possible using this filter:

    https://searchandfilter.com/documentation/action-filter-reference/#filter-input-object

    Daniel Slade
    #233286

    We got it working with this code:

    function my_plugin_search_filter_change_label($input_object, $sfid) {
      if ($sfid == 58513 && $input_object['name'] == '_sf_post_type') {
        foreach ($input_object['options'] as $key => $option) {
          if ($option->label == 'Posts') {
            $input_object['options'][$key]->label = 'Articles';
          } 
        }
      }
      return $input_object;
    }
    add_filter('sf_input_object_pre', 'my_plugin_search_filter_change_label', 10, 2);
    Trevor Moderator
    #233292

    Thanks for getting back to me and sharing that code. I will close this thread for now.

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

The topic ‘Possible to change Post type Name in filter?’ is closed to new replies.