WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Jack Chappell
    Member
    Posted 8 months 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 8 months 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 8 months 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 8 months 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 8 months ago #

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

  6. martcol
    Member
    Posted 8 months 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 8 months ago #

    Thank you very much, sorted!

  8. martcol
    Member
    Posted 8 months ago #

    Phew!

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

  9. martcol
    Member
    Posted 8 months 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 8 months ago #

    Thank you for your help Martcol

  11. Philipp Kainz
    Member
    Posted 7 months ago #

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

Reply

You must log in to post.

About this Topic