WordPress.org

Forums

[resolved] [Theme: Responsive] Social Icons in footer open in new window (11 posts)

  1. Jack Chappell
    Member
    Posted 2 years ago #

    Hey guys,

    I am designing my 3rd WordPress site, (I don't know much HTML) and was just wondering how i get my Linkedin social icon from my footer (on the site wwww.carat-consultants.co.uk/wordpress) to open in a new window?

    I am using the Responsive WordPress Theme

  2. martcol
    Member
    Posted 2 years ago #

    To get a link to open a new window/tab you need to use the target attribute in the anchor element.

    How you do that depends on how the social icons are added to your site. If they are hard coded then it's easy but if they are added with a plugin in or as a theme option, I couldn't tell you how to do that.

  3. Jack Chappell
    Member
    Posted 2 years ago #

    Martcol, i have tried this, these icons are built in with the Responsive theme, but i can't find where the target=blank would go?

    In my footer.php it reads this:

    if( !empty( $responsive_options['linkedin_uid'] ) ) {
    					echo '<li class="linkedin-icon"><a href="' . $responsive_options['linkedin_uid'] . '">'
    						. '<img src="' . responsive_child_uri( '/core/icons/linkedin-icon.png' ) . '" width="24" height="24" alt="LinkedIn">'
    						. '</a></li>';
    				}
  4. martcol
    Member
    Posted 2 years ago #

    $responsive_options['linkedin_uid'] . '" target="_blank">'

    I am punching above my weight here but I would try that but with a sense there might be a better way of doing it and it might not work!

  5. Jack Chappell
    Member
    Posted 2 years ago #

    Didn't seem to work, just removed the footer completely, nice try though

  6. martcol
    Member
    Posted 2 years ago #

    if( !empty( $responsive_options['linkedin_uid'] ) ) {
    					echo '<li class="linkedin-icon"><a target="_blank" href="' . $responsive_options['linkedin_uid'] . '">'
    						. '<img src="' . responsive_child_uri( '/core/icons/linkedin-icon.png' ) . '" width="24" height="24" alt="LinkedIn">'
    						. '</a>';

    }
    So try sticking it before the href like that?

    After this, we will need to wait for a WordPress Guru!

  7. Jack Chappell
    Member
    Posted 2 years ago #

    Thank you very much, sorted!

  8. martcol
    Member
    Posted 2 years ago #

    Phew!

    For a moment there I thought we were going to crash the whole internets!

  9. martcol
    Member
    Posted 2 years ago #

    PS. If you aren't using a child theme, don't forget these kind of edits will be lost if you ever update the theme.

  10. Jack Chappell
    Member
    Posted 2 years ago #

    Thank you for your help Martcol

  11. Philipp Kainz
    Member
    Posted 2 years ago #

    This helped a lot!!!
    Thank you very much :)

Topic Closed

This topic has been closed to new replies.

About this Topic