Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #222321

    In my portfolio items I have set to “define custom link”. On a page where I want to display the portfolio items I have used the portfolio grid and set Link Handling to “open the entry on a new page”. When clicking on the portfolio item on frontend it opens the link in the same window. Any ideas how I could get the link to open in a new window/tab? Thanks.

    #223280

    Hi heikilaja!

    The “open the entry on a new page” won’t change the link target (same tab/window or new tab/window) but it tells the theme to open the single entry immediately without the ajax effect (i.e. see: http://kriesi.at/themes/enfold/portfolio/portfolio-ajax/ where the ajax preview will pop up first). If you want to open your custom link in a new tab/window open up wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/portfolio.php and replace

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

    with

    
    $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>";
    

    Cheers!
    Peter

    #223432

    Thanks Peter! Unfortunately it didn’t help. In the suggested portfolio.php file I now have:

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

    Is that how it should be? I have only set a title and an external custom link for my portfolio items. When I click on the title of the portfolio item on the frontend, the target external page still opens up in the same window. Any suggestions?

    Additionally, I have some items that do not have a link and for these I would like to display only the title on frontend without linking it anywhere externally or internally. Is there a way to achieve this? Right now an empty portfolio item page opens up when I leave the “Link portfolio item to external URL” empty.

    #224815

    Hi!

    1) I corrected the instructions here: https://kriesi.at/support/topic/portfolio-custom-link-to-open-in-a-new-page/#post-223280 . I think I gave you the wrong code line the first time.

    2) There’s no option but you can try to use css to deactivate the click event. Insert this code into the quick css field:

    
    .post-entry-2721 a{ pointer-events: none; }
    

    and replace 2721 with the id of the entry where you want to remove the link. If you want to remove it from several entries duplicate the selector and separate it with a comma like:

    
    .post-entry-2721 a, .post-entry-2725 a{ pointer-events: none; }
    

    Best regards,
    Peter

    #229041

    Works. Thanks a lot.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Portfolio custom link to open in a new page’ is closed to new replies.