Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Meeker on
Hello,
I want to add a div tag specifically around one content-type. In my example, I have many different types - news, page, story, etc. However, I want to add a div specifically around a content type called news. I can't work out how to do this. The website does use the Views module, but that is specifically only for news snippets blocks. Any ideas where I should be altering this?
Thanks...
Comments
---
Check out the Display Suite module. It will allow you to create a custom style template for each content type (or just one). They have a few built-in templates but you can create your own (literally just putting the new div).
Unfortunately, Display Suite
Unfortunately, Display Suite only allows custom templates in D7, I have D6. One solution I had was to alter views.view.tpl.php. The variable classes pulls in a string of CSS classes appropriate to that page. I want to create an if statement that adds some text inside the div. As it is:
My idea:
My problem is that the following code always inserts the text some-newcode-inside-div regardless of whether or not the css class contains the string sample-text.
Any ideas?
---
A custom node-[content_type].tpl.php template file.
That sounds interesting.
Checkin it out
That is solved! Many thanks
That is solved! Many thanks for your solution. I actually needed this so i could add microdata tags to specific content types.