Ajax Search and filter template

Support General Ajax Search and filter templateResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #29969
    Nicholas CoxNicholas Cox
    Participant

    Hi

    I was wondering if there is a way to query all posts and return the results using metabox but allow to do this via ajax? so I can use search and filtering via JavaScript to add in infinite scroll etc.

    I know I can query posts via metabox, but is it possible to hook in ajax so I can update search results on the front end of the website? also caching would be a bonus too.

    I can see you do this for object fields in the backend https://metabox.io/meta-box-updates-better-performance-for-object-fields-mb-core-and-new-settings-page/ but was wondering do you do the same for front end search result pages?

    I can see there is a plugin called SearchWP but I am after creating my own scripts as I do not want to use 3rd party plugins.

    Thanks

    Nick

    #29974
    Nicholas CoxNicholas Cox
    Participant

    Also I have been checking out using custom API endpoints and using them for search and filter posts. I know Metabox adds fields into the API as I have the addon installed. What are your thoughts on using the wordpress rest api over admin-ajax.php?

    #29986
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The feature Ajax Search is only supported for the field select_advanced to select the value. We do not handle any search function on the front end. If you want to create a search form on the frontend by using Ajax or Rest API, this article might help you to do that https://sabrinazeidan.com/wp-rest-api-search-with-autocomplete-with-vanilla-js/

    #30019
    Nicholas CoxNicholas Cox
    Participant

    thanks for the link, very useful.

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