I am using views for front page. I was able to customize some things.

But I have some <h1></h1> in the body of an article and for the frontpage I want to change that automatically into <h2></h2>. Is that possible with views and if yes, how?


If you are having issue with the content that is being printed on the front page. Then you can create a page--front.tpl.php and print the variable according to the requiremt.

If $title gives you the <h1> and <h2> tags, then you can strip_tags($title, 'tags that need to be maintained e.g. <a>') to remove the tags.

If you have issues with views field label, you can use 'Rewrite the output of this field' and 'Strip HTML tags' to change the output mentioned in the image below:-

enter image description here

Hope it will help!


Assuming you are using a page display and set this page as the front page. Under the advanced section in views there is a section called theme, next to that is a link called 'information'. When clicking that you see a list of templates used by views. You can copy the one that is used for your frontpage and edit that.

for example views-view--page.tpl.php, is listed in one of my views. I would copy that name and make a new tpl file in my theme. Then copy the content of a template higher up in the hiarchy of the list this tpl name was in and put it in the new tpl. Then you can change it to fit your needs

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.