Hi, I hope someone can help me. I'm developing my themes. An issue I have is that the default title of the content created when adding content is wraped by an h2 tag, I want to change this to h1. So I edited this part of the node.tpl.php file in my garland theme directory.
It worked for the content type, 'page'. But hasn't worked for my custom content type, 'artnews'.
My understanding was that changing node.tpl.php will change the theme for all nodes, but this hasn't happened. The way I managed to change the h2 tags to h1 for my custom content type, 'art news' is to edit the page.tpl.php.
Why didn't editing the node.tpl.php work for all content types but instead just the content type, 'page'?
Is this the way most people would go about theming different content types? Or is there a better way?
cheers
Mike
Comments
Hi Mike, your approach was
Hi Mike,
your approach was totally correct. If you alter node.tpl.php you change the template for every node (unless there is a more specific template file in your theme directory like node-artnews.tpl.php).
But what really is a bit confusing in the beginning is the fact, that when you look at a node (like yoursite.dev/node/1) the title will be rendered in page.tpl.php. But when you look at a listing of nodes (like yoursite.dev/node) only then the title gets rendered by node.tpl.php. That's what the $page == 0 part in node.tpl.php means:
Was that comprehensible? :-)
Cheers,
Johnny.
Glad i'm on the right
Glad i'm on the right track.
Yes it's strange, the node I created using the 'page' content type (node/1) was rendered from node.tpl.php but the node I created from my custom content type (node/2) was rendered from page.tpl.php. Strange. I wonder why?
I've got round it by adding the following code to template.php:
Then adding a theme for my art_news node called page-node-art_news.tpl.php
Still interested to know why node.tpl.php didn't work for all nodes though.
cheers
Mike