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

    Hello,
    I changed some portfolio.php and functions.php. The link has opened in same window.
    Now there is double title of portfolio item

    
                        if(!empty($title))
                        {
                            $markup = avia_markup_helper(array('context' => 'entry_title','echo'=>false, 'id'=>$the_id, 'custom_markup'=>$custom_markup));
                            $output .= '<header class="entry-content-header">';
                            $target = !empty($custom_link) ? "target='_blank'" : '';
    						$output .= "<h3 class='grid-entry-title entry-title' $markup><a href='{$title_link}' $target title='".esc_attr(strip_tags($title))."'>".$title."</a></h3>";
                            
                            if(!empty($title_link))
                            {
                            	$output .= "<a href='{$title_link}' title='".esc_attr(strip_tags($title))."'>".$title."</a>";
                            }
                            else
                            {
                            	$output .= "".$title."";
                            }
                            
                            $output .= '</h3></header>';
                        }


    Can any one help me?
    Regards,
    Bartek

    #455126

    Hi bart_one!

    Please add following code to Functions.php file in Appearance > Editor

    function add_custom_target(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery('.grid-entry-title a').attr('target','_blank');​
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_target');

    Cheers!
    Yigit

    #455299

    Thank you for your interest.
    But the problem still has not gone away. You might see page: link

    #455487

    Hey!

    Remove this line:

     if(!empty($title_link))
                            {
                            	$output .= "<a href='{$title_link}' title='".esc_attr(strip_tags($title))."'>".$title."</a>";
                            }
                            else
                            {
                            	$output .= "".$title."";
                            }

    Best regards,
    Ismael

    #455498
    This reply has been marked as private.
    #455592

    Hi!

    Just to be clear, you want to open the link in another tab or window? Please remove the modifications above, then look for this code:

    if(!empty($title_link))
                            {
                            	$output .= "<a href='{$title_link}'>".$title."</a>";
                            }

    Replace it with:

      if(!empty($title_link))
                            {
                            	$output .= "<a href='{$title_link}' target='_blank'>".$title."</a>";
                            }

    Regards,
    Ismael

    #455596

    So my mistake. I was talking about opening a new tab. Checking the amendment.

    Greetings,
    Bartek

    #455600

    Hey!

    Has that solution worked out for you?

    Cheers!
    Basilis

    #455613

    Nothing has changed. I do not know PHP.
    Now the code looks like this:

     if(!empty($title_link))
                            {
                            	$output .= "<a href='{$title_link}' target='_blank'>".$title."</a>";
                            }
                            else
                            {
                            	$output .= "".$title."";
                            }
                            
                            $output .= '</h7></header>';
                        }

    Greetings,
    Bartek

    #455752

    Hey!

    Please revert the portfolio.php file back to default then do the suggested modification above. You have to remove this line of code:

    $target = !empty($custom_link) ? "target='_blank'" : '';
    						$output .= "<h3 class='grid-entry-title entry-title' $markup><a href='{$title_link}' $target title='".esc_attr(strip_tags($title))."'>".$title."</a></h3>";

    Regards,
    Ismael

    #463685

    Hello,
    I returned to the subject and tried again the above modifications. I could not achieve the desired result. I do not know whether I described the problem. Well, I would like to open a link to an external URL (eg http://sferio.pl/…swidnica.html or virtual tour on Google Drive) in a new tab by clicking on the thumbnail portoflio.
    Please help and detailed instructions.
    Greetings.
    Bartek

    #463891

    I found a solution. The code from this topic running

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Portfolio link – how to open in new window’ is closed to new replies.