Support » Plugin: Beautiful taxonomy filters » Search/Text Field

  • Resolved hamiltonbrooke

    (@hamiltonbrooke)


    Hi Jonathan,

    We’re big fans of your Beautiful Taxonomy Filters plugin.

    Is there an easy way of extending the plugin functionality to include a search/text field?

    We currently use it on this people page where you can filter by department and location.

    https://www.praxisifm.com/about-us/our-people/

    We would like to be able to extend the plugin functionality so that you can also search by ‘Name’ which is the title of each of the posts.

    Many thanks,

    Ollie@HB

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jonathandejong

    (@jonathandejong)

    Hi Ollie,

    Thank you for those kind words 🙂

    It is fairly easy to extend it with a search field if you have some experience developing in WordPress.
    It has to be done in a few steps:

    1. Add a custom search input field to the filter module using one of the actions provided. For example beautiful_actions_beginning_form. You should call it something other than s tho to avoid WPs own search taking over. I usually give it name="search"
    2. Either hook into the action beautiful_actions_before_redirection and add the $_POST['search'] as a $_GET['search'] and it will automatically be appended to the url OR use the filter beautiful_filters_new_url and append it yourself at the end using the add_query_arg( 'search', $_POST['search'], $new_url ); function. Either way you should end up on a filtered url like /posttype/taxonomy/term/?search=searchterm
    3. Finally hook into the pre_get_posts action and modify the WP_Query parameters if the $_GET[‘search’] parameter is set. like $query->set( 's', esc_html( $_GET['search'] ) );

    Like I said, these instructions should be more than enough to get a developer started on and making a search field work. However there’s currently no plans to include this per default in BTF.. At least not until I’ve sorted out some other stuff first 🙂

    Best of luck!

    Hi Jonathan,

    Thank you for your assistance with this.

    I don’t suppose you would be able to provide me with the full sets of code to achieve this?

    Many thanks,
    Ollie@HB

    Plugin Author Jonathandejong

    (@jonathandejong)

    Hi,

    Sorry that’s way beyond what support I can offer here on an open source plugin 🙂
    You can certainly find a WordPress developer or agency to help you out tho!

    Myself are employed by a Swedish agency which does not do small tasks but rather build and/or maintain larger sites so that’s not an option I’m afraid.

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