Need to create template file to be used on all of a certain Content Type.
Hi All,
I’m relatively new to Drupal 7, but have watched all of the themeing videos here a time or two. What I need is to have a new layout template that will be used on all new content created for a certain content type, in my case (community pages).
These pages need to be to be generated without sidebar-first and sidebar-second for various reasons. I use the sidebars in other parts of the site, so I can’t just disable them.
So, how to I establish a template file that will be called to build the specific “content type” for my community pages? I checked the post here but didn’t see an answer. Thanks for the help. I love the videos by the way.
Here are some of my findings so far. Just need some help pulling it all together:
http://drupal.org/node/1089656 - Drupal Theme Hook Suggestions
http://drupal.org/node/1035656 - Drupal community post which seems to be an answer, although a little confusing for my current understanding of Drupal
Phil
Specs:
D7
Bartik theme
Bartik subtheme
Something is still not quite right. Now I'm getting these two bug notices:
Notice: Undefined index: node in bartiksub_process_page() (line 7 of C:\Users\team\Documents\_sites\yo8\sites\all\themes\bartiksub\template.php).
Notice: Trying to get property of non-object in bartiksub_process_page() (line 7 of C:\Users\team\Documents\_sites\yo8\sites\all\themes\bartiksub\template.php).
The suggestions in this post appear to work, but I'm not sure that I added the processes function correctly.
Post: http://drupal.org/node/1035656
Here is what I did:
1) Created a template.php file for my subtheme.
2) Added only this code to my newly created subtheme/template.php file:
/* code starts */
function subtheme_process_page(&$variables) {
$variables['theme_hook_suggestions'][] = 'page__'. $variables['node']->type;
}
/* code ends */
Questions?:
1) Do I need to do anything else, or is this a solid way of doing this?
2) Do you see this causing any problems elsewhere?
Thanks!