Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #15463

    Hi All! This forum is so helpful. I was able to integrate a custom field into my post and use it to launch a URL in a new window (for the post title and “read more” links… However, I’m not too sure how I can do that for the Preview Picture. Below is what I added to the “big picture” section… since there’s no “big picture”.. I want the portfolio post smallpicture to link to an outside URL website (non picture). This code works! But I’d like to open it into a new window instead of the parent.

    // no bigpicture? => no lightbox
    if ($preview_big == “” || $k_option[‘portfolio’][‘portfolio_click’] == 2) { $lightbox = ”; $link = true; $link_url = get_post_meta($post->ID, ‘url’, true); }
    // the kriesi_build_image function used here checks if the image should be resized.
    // the function is located in framework/helper_functions

    Any suggestions? Thanks for your help in advance!


    If the url is an external url you can use following js code – add it to js/custom.js (at the very top after the document.ready function):

    jQuery(".content a").filter(function() {
    return this.hostname && this.hostname !== location.hostname;
    }).attr('target', '_blank');


    Thanks, Dude. Unfortunately this doesn’t work. I add the code to the top (right after the first document.ready function

    <div class="box box_small box<?php echo $boxnumber; ?>">

    <?php echo $preview; // echo the preview image ?>

    ^I think somehow I need to target this to ‘_blank’

    the javascript function above doesn’t seem to work.



    Can you add the js code to js/custom.js and post a link to your website please?




    I added it but it doesn’t work. Because I am not designating a ‘big image’ i am having it fetch the custom field ‘url’. It works everywhere else where I can echo the link but I need to specifically open this link in a new page. It would be a link to a website not an image (refer to how the title and “View App” hyperlinks to new page.

    jQuery(".content a").filter(function() {
    return this.hostname && this.hostname !== location.hostname;
    }).attr('target', '_blank');

    ^Theoretically would this make all “content” links open in a new window? I just want to specify the one that’s not working correctly:

    <?php echo $preview; // echo the preview image ?>

    if preview image can link to new window with the ‘url’ custom field.


    1) Please try to clear your browser cache – it seems to work for me here.

    2) You can replace: “.content a” with a specific selector like “.page-id-10 .content a” (applies the function to the links on the page with the id 10) or use “.content .portfolio_entry .box a” – this rule will only affect the portfolio page thumbnails.


    Hi, it’s working now because Instead of showing the preview image i just directly called to echo the custom field assigned to the small preview image and linked it manually.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Opening 'bigpicture' in "_blank" using custom field’ is closed to new replies.