How to query the WPSOLR results in my theme?

  • finalwebsites
    Participant
    2 years, 10 months ago #16785

    Hi,
    I would like to use some queries in my WordPress theme, for example to get some related posts.
    Using the free version of Yith woocommerce ajax search widget I noticed that it works very well using the get_posts() function. If I use the same function somewhere only the title and description are search.

    So what is the official way to create a query in my WP Theme to receive results from WPSOLR?
    Is there a filter I can use?

    wpsolr
    Keymaster
    2 years, 10 months ago #16786

    We have the Toolset Views add-on to do that. Just activate it, create your Toolset View, paste it in your page. WPSOLR will manage the queries behind the scene.

    finalwebsites
    Participant
    2 years, 10 months ago #16787

    I don’t wanna use a different plugin for that (definitively not Toolset).
    Is there no way to do that using PHP code? Any documentation for developers?

    wpsolr
    Keymaster
    2 years, 10 months ago #16788

    WPSOLR was built for replacing archives queries (search, taxonomies …). There are no good way to build your own custom queries.

    finalwebsites
    Participant
    2 years, 10 months ago #16789

    You say that there is no way to select simply 5 products based on a search query from WPSOLR.
    Just be some PHP code? Or using WP functions?
    Please explain why the get_posts() function works this way in the YITH ajax search plugin.
    I tried it and the function can search on custom field values which are only indexed by WPSOLR

    wpsolr
    Keymaster
    2 years, 10 months ago #16790

    There is no official way, no.

    It has been done in the plugin, but in very specific conditions.

    You can read the YITH Ajax search add-on code if you want. But it remains internal code, and it can change in the future. Unless you use the predefined actions/filters that you can find also in the add-on code.

    • This reply was modified 2 years, 10 months ago by wpsolr.
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.