Tagged: 

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #11498

    Hi guys,

    I’m working in Propulsion and have the Twitter widget added to the side bar. Now I noticed that all social buttons open links within the same window. What/where do I need to change that to have it open in a new window?

    Thanks.

    #71967

    Open up propulsionfooter.php and replace:

    <ul class="social_bookmarks">
    <?php

    //contact icon
    $contact_page_id = avia_get_option('email_page');
    if (function_exists('icl_object_id')) $contact_page_id = icl_object_id($contact_page_id, 'page', true); //wpml prepared
    if($contact_page_id) echo "<li class='mail'><a href='".get_permalink($contact_page_id)."'>".__('Send us Mail', 'avia_framework')."</a></li>";

    if($dribbble = avia_get_option('dribbble')) echo "<li class='dribbble'><a href='http://dribbble.com/".$dribbble."'>".__('Follow us on dribbble', 'avia_framework')."</a></li>";
    if($twitter = avia_get_option('twitter')) echo "<li class='twitter'><a href='http://twitter.com/".$twitter."'>".__('Follow us on Twitter', 'avia_framework')."</a></li>";
    if($facebook = avia_get_option('facebook')) echo "<li class='facebook'><a href='".$facebook."'>".__('Join our Facebook Group', 'avia_framework')."</a></li>";

    ?>

    <li class='rss'><a href="<?php avia_option('feedburner',get_bloginfo('rss2_url')); ?>"><?php _e('Subscribe to our RSS Feed', 'avia_framework')?></a></li>

    </ul>
    <!-- end social_bookmarks-->

    with:

    <ul class="social_bookmarks">
    <?php

    //contact icon
    $contact_page_id = avia_get_option('email_page');
    if (function_exists('icl_object_id')) $contact_page_id = icl_object_id($contact_page_id, 'page', true); //wpml prepared
    if($contact_page_id) echo "<li class='mail'><a href='".get_permalink($contact_page_id)."'>".__('Send us Mail', 'avia_framework')."</a></li>";

    if($dribbble = avia_get_option('dribbble')) echo "<li class='dribbble'><a target='_blank' href='http://dribbble.com/".$dribbble."'>".__('Follow us on dribbble', 'avia_framework')."</a></li>";
    if($twitter = avia_get_option('twitter')) echo "<li class='twitter'><a target='_blank' href='http://twitter.com/".$twitter."'>".__('Follow us on Twitter', 'avia_framework')."</a></li>";
    if($facebook = avia_get_option('facebook')) echo "<li class='facebook'><a target='_blank' href='".$facebook."'>".__('Join our Facebook Group', 'avia_framework')."</a></li>";

    ?>

    <li class='rss'><a>"><?php _e('Subscribe to our RSS Feed', 'avia_framework')?></a>

    <!-- end social_bookmarks-->

    #71968

    Hi Dude, I tried this. Just adding the target=”_blank” code seems to have some sort of other effect where the footer isn’t shown anymore and images won’t load either. I’m building it on my localhost so unfortunately cannot show whats happening.

    #71969

    Hey!

    I adjusted the code above. The ” caused an error with the php syntax but the new code should work fine.

    Best regards,

    Peter

    #71970

    Thanks, now it works in the footer. To make the same changes for social icons next to the search bar I did the same in functions.php.

    Now I also wanted the side bar social links and advertising widget image links to open in a new window. In class-framework-widgets.php I was able to get that to work by adding the same code under the Avia Tweetbox line so the title opens in a new window as well. Same for Avia Advertising widget but there I did have to add target=”_blank” again (pair of parentheses instead of single).

    There’s one tiny thing that I cannot find. Within the Tweetbox I would like mentioned links to open in a new window too. Can you tell me where to fix that? That would make my search for links to new windows complete, very much appreciated!

    #71971

    It’s not easily possible to achieve this with php code because the content is provided by twitter. However you can try the js code snippet from here: http://www.electrictoolbox.com/jquery-open-offsite-links-new-window/ – I’d use following (slightly modified) version:

    jQuery(".tweets a").filter(function() {
    return this.hostname && this.hostname !== location.hostname;
    }).attr('target', '_blank');

    - add it to js/avia.js after the document.ready code line.

    #71972

    I tried this and could not get the desired result. I changed “.tweets a” to “slideshow.container” but could not get the slideshow image to launch a new window when clicked. Any other ideas?

    #71973

    Hey!

    Try following code instead:

    jQuery(".slideshow_container a").filter(function() {
    return this.hostname && this.hostname !== location.hostname;
    }).attr('target', '_blank');

    Regards,

    Peter

    #71974

    Hello,

    I’m trying this out in the Angular theme. It works fine for the partner logo list, if I remove the .slideshow_container, but not for the external links in the portfolio items.

    Is their a way to do it with jQuery or can I edit the templates somewhere?

    Thanks!

    #71975

    Hi mwouters,

    If you mean in the fields for the meta data, you can just use raw html links. So:

    <a href="http://google.com target="_blank">www.google.com</a>

    Regards,

    Devin

    #71976

    Ok, that works indeed! Just for info, in which script are those values checked and transformed into links? Because you can also just fill http://www.google.com and it automatically makes it a link.

    #71977

    Hi,

    Yes you can do that but you will lose the target=’_blank’ which is responsible for opening the link to a new window which I think is the point of this whole thread.

    Regards,

    Ismael

Viewing 12 posts - 1 through 12 (of 12 total)

The topic ‘Get twitter widget links to target to blank’ is closed to new replies.