Before you ask please READ THIS

target _blank on custom fields links...

edited June 2014 in Beach Please Posts: 21
I promise this is my last post for today.

I guess everything is in the title : is it possible to open link in a new tab or window ?
i'm talking about links in meta fields on work page, and also alternative links on galleries.

If it needs to add some _target blank in the code, please tell me where !

Than i hope i won't have to ask you anything, i don't want to abuse on your nice support!!

Comments

  • AirAir
    Posts: 10,970
    Hello

    Meta fileds:
    file single-work.php, line 58
    if(sizeof($pieces) == 1){
                                    $fields .= '<span>'.make_clickable($temp).'</span>';
                                }
                                else{
                                    $fields .= '<span><em>'.$pieces[0].'</em>'.make_clickable($pieces[1]).'</span>';
                                }
    Instead of make_clickable you will have to use own code.

    Galleries:
    file galleires-list.php, line 103
    echo '<a class="g-item" href="'.esc_url(get_permalink()).'" id="gallery-' . get_the_ID() . '" ' . $genre_string . '>';
    You will have to detect if alternative link is used and add your param then.

    With regards.
  • edited June 2014 Posts: 21
    That's exactly what i was looking for :

    this is the working code in single-work.php on line 58 :
    
    if(sizeof($pieces) == 1){
                                    $fields .= '<span>'.make_clickable($temp).'</span>';
                                }
                                else{
                                    $fields .= '<span><em>'.$pieces[0].'</em>'.links_add_target(make_clickable($pieces[1])).'</span>';
                                }
    
    and the one for the galleries-list.php on line 103:
    
     echo '<a class="g-item" href="'.esc_url(get_permalink()).'" target="_blank" id="gallery-' . get_the_ID() . '" ' . $genre_string . '>';
    

    Advice for people who's using thoses codes : don't forget to save thos files in case of update, and check the changelog !

    Thanks a lot !
    Post edited by Air on
  • AirAir
    Posts: 10,970
    :-)
    You can copy changed template to child theme and it will be used instead. Of course if you use child theme.

    With regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!