Januas

  1. Home
  2. Docs
  3. Januas
  4. Frequently Asked Questions
  5. How to Open Facebook, Twitter and Rss Links in a New Page

How to Open Facebook, Twitter and Rss Links in a New Page

When visitors click on the Facebook, Twitter and Rss icons they leave your site. There is a very simple way to make these links open in a new page.

Follow this easy tutorial:

 

1. Please make a backup of the files you are about to edit before any updates.

2. Open the file wp-content/themes/januas/lib/widget-connect.php

3. You will see this function in the widget-connect.php file

function widget($args, $instance) {
extract($args);
$title = apply_filters(‘widget_title’, $instance[‘title’]);
echo $before_widget;
if ($title)
echo $before_title . $title . $after_title;

if (!empty($instance[’email’]))
echo ‘<a href=”mailto:’ . $instance[’email’] . ‘”><img src=”‘ . get_stylesheet_directory_uri() . ‘/lib/images/mail.png” alt=”Email” /></a> ‘;
if (!empty($instance[‘rss’]))
echo ‘<a href=”‘ . $instance[‘rss’] . ‘”><img src=”‘ . get_stylesheet_directory_uri() . ‘/lib/images/rss.png” alt=”RSS” /></a> ‘;
if (!empty($instance[‘twitter’]))
echo ‘<a href=”‘ . $instance[‘twitter’] . ‘”><img src=”‘ . get_stylesheet_directory_uri() . ‘/lib/images/twitter.png” alt=”Twitter” /></a> ‘;
if (!empty($instance[‘facebook’]))
echo ‘<a href=”‘ . $instance[‘facebook’] . ‘”><img src=”‘ . get_stylesheet_directory_uri() . ‘/lib/images/facebook.png” alt=”Facebook” /></a> ‘;
if (!empty($instance[‘linkedin’]))
echo ‘<a href=”‘ . $instance[‘linkedin’] . ‘”><img src=”‘ . get_stylesheet_directory_uri() . ‘/lib/images/linkedin.png” alt=”Linkedin” /></a> ‘;

echo $after_widget;
}

4. Replace it with this code:

function widget($args, $instance) {
extract($args);
$title = apply_filters(‘widget_title’, $instance[‘title’]);
echo $before_widget;
if ($title)
echo $before_title . $title . $after_title;

if (!empty($instance[’email’]))
echo ‘<a href=”mailto:’ . $instance[’email’] . ‘” target=”_blank”><img src=”‘ . get_stylesheet_directory_uri() . ‘/lib/images/mail.png” alt=”Email” /></a> ‘;
if (!empty($instance[‘rss’]))
echo ‘<a href=”‘ . $instance[‘rss’] . ‘” target=”_blank”><img src=”‘ . get_stylesheet_directory_uri() . ‘/lib/images/rss.png” alt=”RSS” /></a> ‘;
if (!empty($instance[‘twitter’]))
echo ‘<a href=”‘ . $instance[‘twitter’] . ‘” target=”_blank”><img src=”‘ . get_stylesheet_directory_uri() . ‘/lib/images/twitter.png” alt=”Twitter” /></a> ‘;
if (!empty($instance[‘facebook’]))
echo ‘<a href=”‘ . $instance[‘facebook’] . ‘” target=”_blank”><img src=”‘ . get_stylesheet_directory_uri() . ‘/lib/images/facebook.png” alt=”Facebook” /></a> ‘;
if (!empty($instance[‘linkedin’]))
echo ‘<a href=”‘ . $instance[‘linkedin’] . ‘” target=”_blank”><img src=”‘ . get_stylesheet_directory_uri() . ‘/lib/images/linkedin.png” alt=”Linkedin” /></a> ‘;

echo $after_widget;
}

 

5. Update the file.

Was this article helpful to you? Yes No