How to include custom fields in search

Home Forums Calendar Products Filter Bar How to include custom fields in search

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1146975
    Tate
    Participant

    Hi, we are a Events Calendar Pro user.
    Our client wants to include Custom Fields in the Calendar Keyword Search. That is, in addition to searching the title, post body, and synopsis, we would like it to also search certain post_meta custom fields.

    Would you please direct me on how to do this?

    #1147189
    Cliff
    Member

    Hi Tate. Our Filter Bar add-on can work with PRO’s Additional Fields functionality, but not regular post_meta / custom fields by default.

    I didn’t find that as an existing feature request at our plugins’ UserVoice page.

    Please do add your feature request there.

    This allows others who are interested in that feature to easily voice their support. We frequently review suggestions there to find out which ones are popular, then we implement as many of them as we can.

    Once you post it, feel free to link to it from here in case anyone comes across this forum thread in the future.

    If you need some coding help to customize Tribe Bar (the default search bar) or Filter Bar, you may want to ask your developer or reference our documentation and list of known customizers.

    #1147532
    Tate
    Participant

    Thank you for your reply. I have added The Event Calendar’s Additional Fields, and created a custom field through that. However, it is not included in the keyword search. Can you please direct me on how to have this field included in the keyword search? I am a programmer, so am comfortable writing code, if you can direct me on where and how to hook in.

    For others reading this thread, I submitted a feature request here: Please vote for it!
    https://tribe.uservoice.com/forums/195723-feature-ideas/suggestions/15543609-include-wp-post-meta-fields-in-keyword-search

    #1147593
    Cliff
    Member

    Tate, to be clear, are you referring to PRO’s Additional Fields or WordPress’ custom fields?

    If you’re talking about PRO’s Additional Fields, they are available via Filter Bar. Here’s a video demonstrating that: https://cl.ly/1N301c3h332y

    However, if you’re wanting the free-form search box in either the Tribe Bar or the Filter Bar to include results from PRO’s Additional Fields and/or WordPress’ custom fields, that functionality does not exist. If this is what you’re wanting, you might want to re-word your UserVoice idea to be more explicit in this regard.

    #1148119
    Tate
    Participant

    Got it. Yes, I am looking for the keyword search (free-form search box) in the filter bar to include custom fields (at least from PRO, but WP would be nice also) in its search.

    Do you know of a way I can adjust the plugin code itself to make this happen? I was unable to locate the pertinent parts of the keyword (free form) search logic. Would you be able to direct me at least to where those parts are located?

    #1148154
    Cliff
    Member

    Our Tribe Bar search just runs the regular WordPress search but restricts to just searching events. Therefore, you mIgot want to look into modifying WordPress default search, possibly   using this as a reference: https://codex.wordpress.org/Custom_Queries#Keyword_Search_in_Plugin_Table

    #1148155
    Cliff
    Member

    Our Tribe Bar search just runs the regular WordPress search but restricts to just searching events. Therefore, you mIgot want to look into modifying WordPress default search, possibly   using this as a reference: https://codex.wordpress.org/Custom_Queries#Keyword_Search_in_Plugin_Table

    #1148156
    Cliff
    Member

    Our Tribe Bar search just runs the regular WordPress search but restricts to just searching events. Therefore, you might want to look into modifying WordPress default search, possibly using this as a reference: https://codex.wordpress.org/Custom_Queries#Keyword_Search_in_Plugin_Table

    #1149767
    Tate
    Participant

    Thank you. I was able to accomplish exactly what I wanted by following the instructions here:

    Search WordPress by Custom Fields without a Plugin

    Copying and adjusting that code worked great. For anyone viewing this later, be aware that the if line should read:
    if ( is_search() || !empty( $_REQUEST['tribe-bar-search'] ) ) {
    So it runs for both WP search, and the Tribe Events Calendar search.

    Thanks again for your help!

    #1149821
    Cliff
    Member

    Excellent. Thanks for sharing for others in the future as well!

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘How to include custom fields in search’ is closed to new replies.