-
AuthorPosts
-
June 5, 2015 at 11:34 am #455049
Hello,
I changed some portfolio.php and functions.php. The link has opened in same window.
Now there is double title of portfolio itemif(!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>'; }
June 5, 2015 at 3:26 pm #455126Hi 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!
YigitJune 5, 2015 at 8:58 pm #455299Thank you for your interest.
But the problem still has not gone away. You might see page: linkJune 6, 2015 at 1:31 pm #455487Hey!
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,
IsmaelJune 6, 2015 at 2:30 pm #455498This reply has been marked as private.June 7, 2015 at 8:04 am #455592Hi!
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,
IsmaelJune 7, 2015 at 8:52 am #455596So my mistake. I was talking about opening a new tab. Checking the amendment.
Greetings,
BartekJune 7, 2015 at 9:19 am #455600Hey!
Has that solution worked out for you?
Cheers!
BasilisJune 7, 2015 at 10:24 am #455613Nothing 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,
BartekJune 8, 2015 at 7:53 am #455752Hey!
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,
IsmaelJune 23, 2015 at 10:53 pm #463685Hello,
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.
BartekJune 24, 2015 at 10:50 am #463891I found a solution. The code from this topic running
-
AuthorPosts
- The topic ‘Portfolio link – how to open in new window’ is closed to new replies.