programatically get drupal views exposed form

Public

With this snippet you can get views exposed form programmatically to show exposed form somewhere on the page.

Get raw version
php
  1. <?php
  2. $view = views_get_view('your_views_machine_name');
  3. $view->set_display('your_views_display');
  4. $view->init_handlers();
  5. $exposed_form = $view->display_handler->get_plugin('exposed_form');
  6. print $exposed_form->render_exposed_form(true);
  7. ?>