Create a Block of Social Media Icons using CCK, Views and Nodequeue

Posted: 23rd June 2010

Tags: drupal-planet, drupal-6, drupal, views, nodequeue, oliverdavies.co.uk

I recently decided that I wanted to have a block displayed in a sidebar on my site containing icons and links to my social media profiles - Twitter, Facebook etc. I tried the Follow module, but it lacked the option to add extra networks such my Drupal.org account, and my RSS feed. I started to create my own version, and then found this Blog post by Hank Palan.

I created a 'Social icon' content type with the body field removed, and with fields for a link and image - then downloaded the favicons from the appropriate websites to use.

However, instead of using a custom template (node-custom.tpl.php) file, I used the Views module.

I added fields for the node titles, and the link from the node's content. Both of these are excluded from being displayed on the site. I then re-wrote the output of the Icon field to create the link using the URL, and using the node's title as the image's alternative text and the link's title.

I also used the Nodequeue module to create a nodequeue and arrange the icons in the order that I wanted them to be displayed. Once this was added as a relationship within my View, I was able to use node's position in the nodequeue as the sort criteria.

To complete the process, I used the CSS Injector module to add some additional CSS styling to position and space out the icons.

About the Author

Picture of Oliver

Oliver Davies is a Web Developer, System Administrator and Drupal specialist based in the UK. He is a Senior Drupal Developer at Microserve and also provides freelance consultancy services for Drupal websites, PHP applications and Linux servers.

Availability

Currently have limited part-time capacity

Currently no spare full-time capacity.