Update at 2015-04-27: Another suggestion by Petu which could render the filter as a block programmatically.
Update at 2014-09-18: An simpler way to do that is to enable the Exposed form in block in the view settings and then render the block as suggested by plano.com.
The following piece of code render the Views Exposed Filter.
$view = views_get_view('<view name>'); $display_id = 'page'; $view->set_display($display_id); $view->init_handlers(); $form_state = array( 'view' => $view, 'display' => $view->display_handler->display, 'exposed_form_plugin' => $view->display_handler->get_plugin('exposed_form'), 'method' => 'get', 'rerender' => TRUE, 'no_redirect' => TRUE, ); $form = drupal_build_form('views_exposed_form', $form_state); print drupal_render($form);
- bUTLER rAINES – Drupal 7 Views 3: How to programmatically embed a Views exposed filter
- Drupal Views – How to render exposed filters in Views 3 programmatically?