Round Rock / Austin, Texas
Drupal Web Developer

Drupal 7 Tips

Adding HTML Tags to Titles in Drupal

By default Drupal will not rendor HTML tags in a node's title.  While the "HTML Title" module works for rendoring the actual node correctly it does not work for printing the title correctly in a view.  Here's a little work around I used.

/* template.php */

function MYTHEME_preprocess_html(&$vars) {
   /*make sure to strip out the extra characters for the page title in the <head> tag */
   $vars['head_title'] = MYTHEME_strip($vars['head_title']);

html in node title drupal 7
View Article

Theme Your Drupal Search Results Page Using a View

Want to make your Search Results page match a view you've already themed and formatted? Good news! You can do this pretty easily with just a few steps.

Theme Search Results Using View
View Article

Theming the Search Form in Drupal

Want to customize the Drupal Search Form with a placeholder, custom size, custom submit button text, or use an image for the submit button?  All of the things can be accomplished by adding a function to your theme's template.php file.


Theme Drupal Search Form using template.php
View Article

Check to see if Drupal Content Type in template.php

Today I came across some error messages on my Search Results page because I was checking for a content type in my template.php file's preprocess_page function. Here's some code to to check that you're actually on a node prior to checking the content type.

Drupal if Content Type
View Article

Using Webform Hints Module to Add Placeholder Text to Webforms

One of the graphics designers I work with LOVES to use Plaeholder text on webforms instead of showing regular ole labels.  By default webforms does not provide an option to enter Placeholder Text.  The solution? Install and configure the Webform Hints Module.

Add Placeholder Text to Drupal 7 Webforms
View Article

How to add the Viewport metatag for Drupal 7 sites

If you want your site to be responsive and mobile friendly, the Viewport metatag must be included in the <head> tag of your html.

To do this in Drupal 7, in your theme's template.php file add this code:


function YOURTHEMENAME_preprocess_html(&$vars) {
  $viewport = array(
   '#tag' => 'meta',
   '#attributes' => array(
     'name' => 'viewport',
     'content' => 'width=device-width, initial-scale=1, maximum-scale=1',
  drupal_add_html_head($viewport, 'viewport');

View Article

How to Check if a CCK Field Exists on a Node

Getting 'index not defined' errors because you're trying to use a field that may not exist or have a value on a node? Here's a way to check to make sure the node has a value for the field before trying to actually do something with the field.

View Article

Want to Control the Thumbnail and Text when you Post or Share Something to Facebook?

Use the Facebook Debug Tool
First, check to see what FB is seeing by using their Debug Tool:

* Note: I definitely saw caching issues so be sure to click the "Fetch" button often.


For the Title and Text:
Use Drupal modules such as "Page Title" and "Metatag" to give you greater control over the <title> and description tags.  Those are what Facebook uses to display the headline and intro text.


Control Facebook Thumbnail Default
View Article

Troubleshooting Tip: Superfish Dropdown Menu Not Working

1) Make sure you have the superfish library installed at /sites/all/libraries/superfish

2) Adjust the jquery version you are using to be 1.7.  This is under /admin/config/development/jquery_update

Drupal Superfish Dropdown Not Working
View Article

Adjusting Cache and Performance Settings in Drupal 7

In Drupal 7 you can configure performance and cache settings under /admin/config/development/performance

drupal 7 performance settings configuration
View Article