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.
Link portfolio images to website
10 posts from 4 voices-
Posted 2 years ago #
-
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.
Posted 2 years ago # -
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.
Posted 2 years ago # -
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
Posted 2 years ago # -
You guys are the best. Thanks Dude and James!! :)
Posted 2 years ago # -
Glad that we could help you :)
Posted 2 years ago # -
Is there any way to do this with only some items?
Thanks.
Posted 1 year ago # -
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.
Posted 1 year ago # -
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. :-)
Posted 1 year ago # -
Can you create me an admin account and send me the login data to: kriesi2000-dude@yahoo.com - I'll look into it.
Posted 1 year ago #
Reply
You must log in to post.














