How to limit search to a specific category

Support MB Views How to limit search to a specific categoryResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27148
    HenriHenri
    Participant

    Hi,

    In a MB view I want to add a search box that only searches posts in a specific category. Now I've managed to add the search box via

    mb.get_search_form()

    Is there a way to add additional code in Twig to limit this function to search for posts of only a specific category? I've found php code, but I would like to add it in the MB view, so in Twig code.

    Kind regards, Henri

    #27161
    Long NguyenLong Nguyen
    Moderator

    Hi Henri,

    Twig is using for creating templates, so there are some limitations if you try to create some logical code like PHP. You can just create a PHP function then call it in the View to show the value.

    #27388
    HenriHenri
    Participant

    Thanks for answer. I was hoping not to have to write PHP 😉

    For now I've found a workaround with the plugin Ivory Search. That works for now using a sidebar.

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