Code to link image to value set in media library
-
I know that was a poorly titled topic – can’t think how to better word it (which is probably why I can’t find the answer in the codex or Google).
On this page: https://www.monogramadvisors.com/test-portfolio/ I have modified a portfolio template that came with the theme this site uses. The theme author had a nice lightbox that opened creating a slideshow of portfolio items.
We don’t want that though. We want the images to link to their respective company website URLs. The portfolio images are essentially featured images in a post, uploaded through media library. As such, we could assign a URL (in this case, to the company website) to these images. However the link code wrapping these images in the theme doesn’t pull from the value set in the media library, since it was only opening that lightbox.
I want to replace the link code with whatever WordPress code will pull the linking URL value from what is set in the media library. I know this should be easy, but I just can’t seem to find it or figure out how to pull it.
If it helps, this is the theme code for displaying the images in the portfolio. It uses theme-developed hooks, and that’s where I am getting lost.
<div class="imgarea <?php if(get_post_meta($post->ID, 'rt_portfolio_image', true)):?><?php echo $button;?><?php endif;?>"> <?php if(get_post_meta($post->ID, 'rt_portfolio_image', true)):?> <a href="<?php echo get_post_meta($post->ID, 'rt_portfolio_image', true);?>" title="<?php the_title(); ?>" rel="prettyPhoto[rt_theme_portfolio]" > <?php if(get_post_meta($post->ID, 'rt_portfolio_thumb_image', true)):?> <img src="<?php echo get_post_meta($post->ID, 'rt_portfolio_thumb_image', true);?>" alt="<?php the_title(); ?>" class="image portfolio preload" /> <?php else:?> <img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo get_post_meta($post->ID, 'rt_portfolio_image', true)?>&w=185&h=71&zc=1" alt="<?php the_title(); ?>" class="image portfolio preload" /> <?php endif;?> </a> <?php endif;?> </div>
Any help very much appreciated.
[No bumping, thank you.]
- The topic ‘Code to link image to value set in media library’ is closed to new replies.