Need to create template file to be used on all of a certain Content Type.

2 replies [Last post]
Last seen: 9 years 50 weeks ago
Joined: 2012-03-15

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: - Drupal Theme Hook Suggestions - Drupal community post which seems to be an answer, although a little confusing for my current understanding of Drupal


Bartik theme
Bartik subtheme

Last seen: 9 years 50 weeks ago
Joined: 2012-03-15
This appears to work, but...

The suggestions in this post appear to work, but I'm not sure that I added the processes function correctly.


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 */

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?


Last seen: 9 years 50 weeks ago
Joined: 2012-03-15
found a bug - still need help!

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).

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:

Contact us

Below are the supported keyboard shortcuts for our video player.

Start / stop video
Go to next video
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
Jump to a percentage (2 is 20%, for example)
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
1 month
6 months
10% off
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.