[themes] Overriding zone etc. templates for specific content types in D7 (Jeff Greenberg)

Danny Englander highrockmedia at gmail.com
Sun Mar 3 17:43:57 UTC 2013


Hi Jeff, 

The custom node template should have two dashes after "node". So for example if your content type is called "Product Type" and the machine name is "product_type", then the node template would be "node--product_type.tpl.php". Note the double dash after node and then the underscore for the content type machine name. This is a change for Drupal 7 as in Drupal 6, it was "node-" with one dash. 

That being said, you can also change the entire layout contextually for Omega by using Delta + Context. This powerful combo gives you the ability to change your Omega sub-theme layout based on a context such as content type, path etc… So now with your Delta theme variation, you can move zones around or whatever you want. It's pretty powerful and amazing. 

I'd say the difference between using a custom node template and Delta + context is if you have specific fields that you want to theme that are unique to a content type, then use  a custom node template or even Display Suite for that matter. If you want to entirely change regions and zones for a content type, i.e., change the page layout, then perhaps use Delta + Context. 

A use case for Delta + Context then would be if you completely want to change the page layout for your home page. Omega 3.x does not use page.tpl.php or a variation thereof so in this case you would want to create a Delta template for <front> and then use a context for that. 

Reference:

http://drupal.org/project/delta
http://drupal.org/project/context
http://drupal.org/project/ds

I think there are some tutorials for this out there as well for Delta + Context. 

-- Danny



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/themes/attachments/20130303/c5d192bb/attachment.html 


More information about the themes mailing list