Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #3820

    Love Avisio. I would like to link the portfolio images to the client’s website. Is this possible? I am a web designer and am using the portfolio page too show my work.

    #43793

    Hey,

    open up template_portfolio.php and replace:

    'display_link' => array($openImage),
    'linkurl' => array ('XL','_preview_big'),

    with:

    'display_link' => external,
    'linkurl' => '',

    Then replace:

    <span>".$prev_image."</span>

    with:

    <span><a href='".get_post_meta($post->ID, 'url', true)."'>".$prev_image."</a></span>

    Afterwards you can set post meta fields to use external urls for the. Call the fields “url” and type in the websites’ adresses as values.

    #43794

    I have made the changes in the template_portfolio.php. Can you tell me how to set post meta fields….I am confused on how to do this. Don’t seem to be getting anywhere.

    thanks.

    #43795

    Hey,

    Firstly, you need to modify the portfolio options to support custom fields. To do this, open /theme_options/portfolio.php and find this code (around line 59):

    $args = array(
    'labels' => $labels,
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'rewrite' => array('slug'=>$slugRule,'with_front'=>true),
    'query_var' => true,
    'show_in_nav_menus'=> false,
    'menu_position' => 5,
    'supports' => array('title','thumbnail','excerpt','editor','comments')
    );

    Change the supports to include custom fields like this:

    $args = array(
    'labels' => $labels,
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'rewrite' => array('slug'=>$slugRule,'with_front'=>true),
    'query_var' => true,
    'show_in_nav_menus'=> false,
    'menu_position' => 5,
    'supports' => array('title','thumbnail','excerpt','editor','comments','custom-fields')
    );

    Next, you need to enable the screen option for custom fields if it’s not already active. If you don’t see this highlighted box on the portfolio page: http://cl.ly/16443l2q3z2j1V1X0d1x then you can enable it under screen options at the top of the page: http://cl.ly/2V2A3A0l391B2k373O1A.

    Once this is completed you can add your custom field. From the code Dude provided above it should be called url so put this in the Name field and the URL you want to link to in the Value field.

    Hope this helps!

    James

    #43796

    You guys are the best. Thanks Dude and James!! :)

    #43797

    Glad that we could help you :)

    #43798

    Is there any way to do this with only some items?

    Thanks.

    #43799

    Yes – replace:

    $prev_image = kriesi_post_thumb($post->ID, array('size'=> array($portfolioInfo[2],'_preview_medium'),
    'wh' => $k_option['custom']['imgSize'][$portfolioInfo[2]],
    'display_link' => array($openImage),
    'linkurl' => array ('XL','_preview_big'),
    'link_attr' => array('class'=>'preloading')
    ));

    with:

    $post_meta = get_post_meta($post->ID, 'url', true);

    if($post_meta){
    $link = 'external';
    }else{
    $link = array($openImage);
    }

    $prev_image = kriesi_post_thumb($post->ID, array('size'=> array($portfolioInfo[2],'_preview_medium'),
    'wh' => $k_option['custom']['imgSize'][$portfolioInfo[2]],
    'display_link' => $link,
    'linkurl' => array ('XL','_preview_big'),
    'link_attr' => array('class'=>'preloading')
    ));

    and

    <span>".$prev_image."</span>

    with:

    <?php if($post_meta){ ?>
    <span><a href='".get_post_meta($post->ID, 'url', true)."'>".$prev_image."</a></span>
    <?php }else{ ?>
    <span>".$prev_image."</span>
    <?php } ?>

    Afterwards you can set post meta fields to use external urls for the. Call the fields “url” and type in the websites’ adresses as values.

    #43800

    Are you sure that the code is correct? It does this: http://bht-design.org.uk/portfolio/

    The middle link is the one that should link to the website.

    Also, would you be able to provide revised code so that the website link opens in a new tab please?

    Many, many thanks. :-)

    #43801

    Can you create me an admin account and send me the login data to: (Email address hidden if logged out) – I’ll look into it.

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

The topic ‘Link portfolio images to website’ is closed to new replies.