Drupal Planet Posts

Theming Tips Blog!

Here pretty soon I'm going to start a blog about theming Drupal, and a few tricks/tips I've discovered over the years of working with this awesome beast. :) Please stay tuned! It's comin' really soon!!

Tags: 

Content Type Page Templates in Drupal

One of the things that has really bothered me about Drupal in the past is it's lack of page templates for content types. In some ways it makes sense that they wouldn't include the ability to make page--content-type-name.tpl.php. However, I often find that when I'm coding up a Drupal theme, the design of the Drupal application that I'm working from demands a different layout for different types of content. If done correctly, that can be an awesome thing!

Upgrading Drupal to use jQuery 1.8

jQuery 1.8.0 has been released! It has probably been brought to your attention a billion times by now. :) Sadly, Drupal by default loads jQuery 1.4. :( But no worries, I'm gonna show you how to use jQuery 1.8 in your Drupal 7 theme without installing any crazy modules. :)
function ThemeName_js_alter(&$js) {
  $js['misc/jquery.js']['data'] = drupal_get_path('theme', 'ThemeName') . '/path/to/jquery-1.8.0.min.js';
}

Rendering Sub Menus in Drupal 7?

I've had headaches in the past trying to render a Drupal menu with not only the parent links, but also all of their children. I've used modules like Nice Menus in the past but it's kind of a messy solution if you just need to print sub-menus. I did come up with a solution, and I thought I'd post it. Hope it's useful to you!

In your template.php

function ThemeName_process_page(&$vars) {	
     $menu_tree = menu_tree_all_data('your-menu-name');
     $vars['menu_expanded'] = menu_tree_output($menu_tree); 
}

Improving Drupal Administration Interface

I've been pretty unhappy with the navigation menus and administration interfaces in Drupal, so recently I've taken upon myself the task of improving Drupal 7's admin UX. Of course, there are some awesome admin themes and menus, etc, available, but they seem to be quickly growing obsolete with the emersion of new, intuitive interfaces that are available on other platforms.

Dries is currently working on Spark, which is awesome! It still seems a bit un-smooth though, if you know what I mean.

Making your Drupal themes Retina Friendly

Apple has really been stepping up their game in the past couple years where screen resolutions are concerned. They now offer a plethora of devices with extremely high resolution screens, which is awesome! They look great, especially when the applications that run on them include high resolution images. When the iPad 3 and Macbook Pro 15 inch Retina emerged, it became obvious that the resolution of images on websites have to be increased.

Updating jQuery in Drupal the Right Way

I recently made a blog post about how to upgrade Drupal's jQuery version from 1.4.4 to 1.8. The problem is, popular contrib modules (views being the main culprit here) and even some core jQuery require an outdated version of jQuery (be 1.4.4, to be exact.). There is a module called jQuery Update, and it works well, but if you need a self contained theme (with no module dependancies) this might be helpful to you.

Twitter Bootstrap 2.1.0 is out, Drupal Ready!

It's fresh off the griddle!

The front end world is all hyped up today, because Mark Otto and Jacob Thornton just released Twitter Bootstrap 2.1.0. Nice! It's got some cool new features, including a new affix javascript library, and submenu dropdowns!! Guess what? I've already updated Base Building Blocks with the new code!

Here's a list of some new features in Twitter Bootstrap 2.1.0!

  • Submenu support on dropdowns

Retina Friendly Favicons?

One of the things that has continually bothered me in the past couple weeks (as a new Retina Macbook user) is the lack of favicons that support retina devices. The other day it occurred to me that I have never made retina-friendly favicons either! So I decided to find a way to make favicons that support retina devices as well as other devices.

My Solution...

Node ID Page Templates

Earlier I posted on how to make a page template based off of the node type. (Slide to the spot). Well now I'm back with a new solution. Occasionally you may find yourself needing to have a page template for a specific node ID. While this should theoretically be rare, in some cases it could be necessary.

An Example Instance