How do add an <h2> tag to a CCK field?

Joined: 12/04/2008

Hello everyone.

I am trying to add an h2 tag to the title field of blog content that i created in CCK. I figured how to mess with the CSS, but I want to wrap it with an h2 tag. Here is the link to showing what I mean

http://www.gcsquared.org/content/consectetur-adipi...

Does anybody know how to do this?

Thanks!

G&G Moderator
G&G Podcast Host
NonProfit's picture
Joined: 06/06/2007
Add HTML to CCK field

Hey Brenden, as far as I know, there is no way of doing this natively. However, you've still got some options.

Listed in order of practicality:
a) If you're using Views and Token, select the title field and "Rewrite the output of this field." Look at the list of tokens, you are likely going to enter <h2>[title]</h2>.

b) Simply style the class Drupal outputs. In your case it looks to be .field-field-blog-title.

c) Check out Form Markup. Edit: Oops, Form Markup only passes classes and IDs, not HTML. Sorry!

d) Write a module.

Hope this helps!

-NP

Joined: 09/09/2008
Contemplate

Personally, I think that I'd use a view (NP's option a above) because I think that's a pretty easy way to go and I don't expect that you have any reason why it wouldn't be appropriate.

Another technique (module) that I've used is Contemplate. Some of my local Drupal developer friends despise this module because if you make a bad enough error you can create a situation where recovery is difficult, but I don't have any experience shooting myself in the foot, this way.

Good luck,
Curt

G&G Moderator
G&G Podcast Host
NonProfit's picture
Joined: 06/06/2007
Semantic CCK

Released today is the Semantic CCK module which gives users the means of customizing the HTML output of CCK fields. -NP