I've got what seem to be random empty <h3>
s appearing whilst displaying a custom content type as a teaser in a pretty standard blocks display through Views. Now this is only a problem because it's adding dimension and padding, which can be aleviated but I'd actually rather like to get to the bottom of why it is happening.
<article class="node-3099 node node-feature node-teaser contextual-links-region
node-by-viewer clearfix" typeof="sioc:Item foaf:Document"
about="/feature/simplifying-copyright-through-digital-technology">
<header>
<h3></h3>
<h1 class="node__title node-title">
...
We've created a subtheme of Zen and only have the following files overriden:
- block.tpl.php
- node.tpl.php
- node--news_story.tpl.php
- node--product.tpl.php
- page.tpl.php
- views-view--page.tpl.php
- views-view-unformatted.tpl.php
I've cleared the views cache, cleared all caches, not got "compress JS/CSS" etc. selected, rescanned the template files but it makes no difference.
I've not added any custom classes to the views display settings, I've not done anything funky in the custom content types either, not the default/teaser displays. Nearly everything is as it is by default. And we're not using grouping, which I've read can be a problem.
In our custom "news_story" template (and the product one too) we'd carried over something in the header from an old build. This was displaying an empty h3 but commenting it out fixed it completely. And it was not in the rendered HTML at all. Unlike the other blocks, like the Features section.
<?php if ($title_prefix || $title_suffix || $display_submitted || $unpublished || !$page || $title): ?>
<header>
<?php //DONT DO THIS WITH THE H3: it injects it even if the field_news_category is ignored?>
<!-- <h3><?php
// Only one of these will be shown (Domain Fields...)
//print render($content['field_subtype']);
print render($content['field_news_category']);
?></h3>-->
<?php
//hide($content['field_subtype']);
//hide($content['field_field_news_category']);
?>
<?php print render($title_prefix); ?>
However, we've not overriden the other custom content types and I can't find anything in any of the other templates that has any h3 or anything. I've looked through Zen and there's nothing there. I've looked through the Views module and in the Theme folder there was a h3 in "unformatted" so I overwrote that and commented out the <h3>
...
<?php
/**
* @file
* Default simple view template to display a list of rows.
*
* @ingroup views_templates
*/
?>
<?php if (!empty($title)): ?>
<!-- <h3><?php print $title; ?></h3> -->
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
<div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"'; } ?>>
<?php print $row; ?>
</div>
<?php endforeach; ?>
And since we're using the "unformatted" format I can only presume that's all that's needed. I also tried commented out the <h3>
in the views-view-unformatted.tpl.php file in the Views module's Theme directory. And clearing Views caches with Drush. But somehow there's still a h3 getting in there...