Exposed filters are either: - Printed in views-view.tpl.php using the $exposed variable. - Printed in a block, probably using the same variable.

This variable ($exposed) contains the exposed sort criteria and filters. I would like to find a way to print them separately. Ideally there would be a way to use something like:

<div id="sort"><?php print $exposed->sort; ?></div>
<div id="filter"><?php print $exposed->filter; ?></div>

Does anyone know of a way you can achieve this? Or in last case how to print each sort and criteria individually?

  • I found how to individually print filters in views-exposed-form.tpl.php: drupal.org/node/674910#comment-2444650
    – ipwa
    Sep 28, 2011 at 21:01
  • hello @ipwa, each widget still must be inside exposed form, or I am wrong?
    – cigotete
    Sep 28, 2011 at 21:29
  • What I need is to have filters in a collapsible fieldset and sort criteria under the fieldset (using toggle links with better exposed filters module). So yes, they can still be in the same form, just separated by markup.
    – ipwa
    Sep 28, 2011 at 23:06

1 Answer 1


If you can not use each item of $widgets in separated way, you can push each widget in a separated array for use each widget across your custom html.

<?php foreach($widgets as $id => $widget): ?>
    array_push($elements, $widget);
<?php endforeach; ?>

echo $elements[0]->widget;
echo $elements[1]->widget;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.