2

I have a content type called Events. I would like to override the tpl file of exposed form in events listing.

I tried events_preprocess_views_exposed_form to add a template suggestion, I tried to add MYTHEME_preprocess_views_exposed_form to do the same thing, I tried simply to add views-exposed-form.tpl.php in my templates directory from MYTHEME directory but with no success.

4

From your question, I could understand that you're using views to show your events list with exposed filters and now you want to override the template of that exposed form.

To override the exposed form template for a particular view, you need to create a template in the following name pattern,

views-exposed-form--view_name.tpl.php

For example if your view name is event_list, then the overridden template will be views-exposed-form--event_list.tpl.php.

Once you added the template clear the cache, now view will use the overridden template for exposed form.

Take the views default exposed form template as base to theme your overridden template - Exposed form template

Note : To just override the template, you do not need any preprocess functions.

  • Worked for me. Overrode my exposed filters for my view named "Events View" with the following filename: views-exposed-form--events-view.tpl.php. Thanks! – ProGrammar Mar 15 '17 at 18:38
  • You can also add a display name to be more specific (if you have different displays for the same view): views-exposed-form--view-name--display-name.tpl.php. For example, a view called "Events View" with the display called "Whats Happening", your template file would be: views-exposed-form--events-view--whats-happening.tpl.php. – ProGrammar Mar 15 '17 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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