Play

Tags: Theme

Add Plus1 Voting Widget to Nodes in Panels

Post to Twitter

If you're using ‎Panels‎ to output your content type and you enable the ‎Plus 1‎ module, you may notice the Plus 1 widget doesn't appear when you view your node.

If you don't see the widget, then you've probably enabled 'no extras' in your Panels node template override. If there's no other reason for enabling this option, you can simply uncheck the box and the Plus 1 widget will appear when you view your node.

If you do need to keep this unchecked, you can add a snippet to either your theme's node.tpl.php or node-customtype.tpl.php.

Open external links in a new window using jQuery

Post to Twitter

The way people have typically opened external links in a new window is to use the attribute target="_blank" in an <a> tag. The problem is that in HTML/XHTML Strict, the target attribute is deprecated.

While you can still use the target attribute if you're using the Transitional DOCTYPE, best practice is to adhere to web standards.

Theming a Specific CCK Field

Post to Twitter

The display of CCK fields is handled by the file content-field.tpl.php which is in the folder sites/all/modules/cck/theme. To override the display of a specific CCK field, the system will look for the format content-field-field_name.tpl.php in your theme directory.

Assuming you have a field named 'files', the name of your override would be content-field-field_files.tpl.php. If you're not sure of the field name go to admin/content/types and select the Fields tab - which will give you an overview of all your CCK fields.

Displaying your Drupal Mission Statement on Multiple Pages

Post to Twitter

While many sites don't need to utilize a mission statement, it can be useful for adding static content to your theme.

I needed to add copy to the header for a client that would appear on all pages, that they could easily edit and wouldn't involve any editing of the theme files. I immediately thought to use the mission statement that's available at admin/build/themes/settings. The only problem being that by default, the Drupal mission statement only appears on the home page.

Tags:
i heart cycling