Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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.

    Code:
    // 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!

    #87599

    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');

    #87600

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

    #87601
    <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.

    #87602

    Hi!

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

    Regards,

    Peter

    #87603

    http://bit.ly/PEn4h1

    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.

    #87604
    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.

    #87605

    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.

    #87606

    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.