Custom Fields
Re-Envisioned
Support MB Views How to limit search to a specific category

  • Creator
    Topic
  • #27148
    Resolved Henri
    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #27161
    Long 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
    Henri
    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 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.