I have a Drupal view where I would like to enter some text in between 'Exposed Filter' and 'Content' sections. What is the safest of doing this? Attached image shows exact location I need text inserted.


enter image description here

2 Answers 2


You need to create a custom template for your view.

Go to /sites/all/themes/YourTheme/templates folder

create a file called views-view--[view-name]--[machine-name].tpl.php

For example if you view name is "Hello World" and machine name is "block_1"

It would be: views-view--hello-world--block-1.tpl.php

Inside your custom template file put:


 * @file
 * Main view template.
 * Variables available:
 * - $classes_array: An array of classes determined in
 *   template_preprocess_views_view(). Default classes are:
 *     .view
 *     .view-[css_name]
 *     .view-id-[view_name]
 *     .view-display-id-[display_name]
 *     .view-dom-id-[dom_id]
 * - $classes: A string version of $classes_array for use in the class attribute
 * - $css_name: A css-safe version of the view name.
 * - $css_class: The user-specified classes names, if any
 * - $header: The view header
 * - $footer: The view footer
 * - $rows: The results of the view query, if any
 * - $empty: The empty text to display if the view is empty
 * - $pager: The pager next/prev links to display, if any
 * - $exposed: Exposed widget form/info to display
 * - $feed_icon: Feed icon to display, if any
 * - $more: A link to view more, if any
 * @ingroup views_templates
<div class="<?php print $classes; ?>">
  <?php print render($title_prefix); ?>
  <?php if ($title): ?>
    <?php print $title; ?>
  <?php endif; ?>
  <?php print render($title_suffix); ?>
  <?php if ($header): ?>
    <div class="view-header">
      <?php print $header; ?>
  <?php endif; ?>

  <?php if ($exposed): ?>
    <div class="view-filters">
      <?php print $exposed; ?>
  <?php endif; ?>

  HERE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

  <?php if ($attachment_before): ?>
    <div class="attachment attachment-before">
      <?php print $attachment_before; ?>
  <?php endif; ?>

  <?php if ($rows): ?>
    <div class="view-content">
      <?php print $rows; ?>
  <?php elseif ($empty): ?>
    <div class="view-empty">
      <?php print $empty; ?>
  <?php endif; ?>

  <?php if ($pager): ?>
    <?php print $pager; ?>
  <?php endif; ?>

  <?php if ($attachment_after): ?>
    <div class="attachment attachment-after">
      <?php print $attachment_after; ?>
  <?php endif; ?>

  <?php if ($more): ?>
    <?php print $more; ?>
  <?php endif; ?>

  <?php if ($footer): ?>
    <div class="view-footer">
      <?php print $footer; ?>
  <?php endif; ?>

  <?php if ($feed_icon): ?>
    <div class="feed-icon">
      <?php print $feed_icon; ?>
  <?php endif; ?>

</div><?php /* class view */ ?>

Note: The above code is an exact copy of views-view.tpl.php located in the /sites/all/modules/views/theme folder. I just added the HERE <<<<<<<<<<<<<<< part after the exposed filter php.

Don't forget to clear/flush the cache to see changes.

  • Thanks again. This works! However I would like to have this text to have some sort of a connection to content area. For an example, assume this text as a description to the table in content area.If the filter outputs zero results, the table disappear but text still appears. How can I link it to content area? Commented May 3, 2016 at 8:20
  • @user2574948 instead of HERE <<<<<<<<< put <?php if ($rows): ?> HERE <?php endif; ?> remember to flush the cache to see changes.
    – No Sssweat
    Commented May 3, 2016 at 8:32

For anyone arriving here for Drupal 8/9 (may apply to D7, not sure):

If it is appropriate, you can enter a table caption to describe the table, which is located within the table element but above the thead and tbody. The caption is editable at (Edit) View > Format > (Table) Settings > Caption (in D8.9).

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.