I am creating a view, and displaying view by using custom template files. As per theme suggestions I named the template file for fields as views-view-fields--blog-display--page.tpl. In this file I want to display labels for the view fields which i have given while adding fields. I tried using

<?php print $fields['label']->content; ?> 

But not able to get the label. What am I doing wrong?


As far as I see in the documentation for views-view-fields.tpl.php (I did not test it myself), the syntax seems to be something like the following:

<?php print $fields['myfield']->label; ?>

(you can also use $fields['myfield']->label_html)

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.