0

I want to show the exposed filter only when there are more than 10 items to filter. Any suggestion to accomplish this?

1 Answer 1

1

Add this to your theme's template.php file:

function THEME_views_pre_render(&$view){
  if ($view->name == 'VIEWNAME' && $view->current_display == 'DISPLAYID' && $view->total_rows <= 10) {
    $view->exposed_widgets = '';
  }
}

This will remove all of the exposed filters. If you have more than one and you only want to remove a single exposed filter, you will have to parse that filter out of the $view->exposed_widgets html string.

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.