Add Instagram Link and Icon in Multipurpose

  • Posted on: 25 April 2015
  • By: h

Multipurpose theme comes with a handy Social Media icon panel. By default, admin can go into the theme settings and fill out the urls for the default social media links: Facebook, Twitter, Google Plus and Pintrest.

To add a new icon to the panel, such as Instagram:

multipurpose.info

settings[instagram_url] = "http://instagram.com"

theme-settings.php

$form['multipurpose_settings']['socialicon']['instagram_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Instagram Address'),
    '#default_value' => theme_get_setting('instagram_url', 'multipurpose'),
    '#description' => t("Enter your Instagram URL. Leave blank to hide."),
  );

templates/page.tpl.php

Under
theme_get_setting('socialicon_display', 'multipurpose')
$instagram_url= check_plain(theme_get_setting('instagram_url', 'multipurpose'));
 
Under header-social div
<?php if ($instagram_url): ?><li>
<a target="_blank" title="<?php print $site_name; ?> in Instagram" href="<?php print $instagram_url; ?>"><img alt="Instagram" src="<?php print base_path() . drupal_get_path('theme', 'multipurpose') . '/images/social/instagram.png'; ?>"> </a>
</li><?php endif; ?>
 
Don't forget to clear caches after saving all the files.