Support » Fixing WordPress » Featured Image – Outbound Link

  • I would like for a Featured Image to link to an external site. I’ve found many plugins that do the opposite, where you can find an external link that will “bring in” an image, but that’s not what I’m looking for.
    I have a Featured Image on site http://www.blah.blah, but would like to link that image to www. notblah.notblah . How do I do this…lol?

Viewing 12 replies - 1 through 12 (of 12 total)
  • anybody got anything?

    Depending on your theme, you should modify the associated .php file.
    If you want your posts’ featured image to link an external site, then look for the single.php file.

    I don’t think you will find this kind of plugins :/ since these functions are triggered from your template!

    <ul class="portfolio">
    
    				<?php
    
    				query_posts('category_name=portfolio&posts_per_page=50');
    
    				if (have_posts()) : while (have_posts()) : the_post();
    
    		 		// if URL else #
    			 	$url = get_post_meta($post->ID, 'URL', false);
    		 		$url = (isset($url[0]) ? $url[0] : '#');
    
    				$category = get_the_category();
    
    				if($category[0]->slug == 'projects')
    					echo '<li class="default toggle" data-open="projects">';
    				else
    					echo '<li class="'.$category[0]->slug.'">'
    				?>
    					<a>">
    						<?php
    						if(has_post_thumbnail())
    							the_post_thumbnail('thumbnail');
    
    						if($category[0]->slug == 'projects'){ ?>
    						<span>
    							<strong><?php echo get_the_title() ?></strong>
    							<?php echo get_the_excerpt() ?>
    						</span>
    						<?php } else { ?>
    						<span>on <?php echo $category[0]->cat_name?></span>
    						<?php } ?>
    					</a>
    
    				<?php endwhile; endif;
    				previous_comments_link();
    				wp_reset_query(); ?>

    I found this, but I don’t know what to add/delete to allow the outbound link.

    I also found this on an existing forum, but am unable to figure out how to merge the two…

    <?php query_posts( 'cat=Featured&posts_per_page=5' ); if( have_posts() ) : while( have_posts() ) : the_post(); ?>
    <?php $key="featured_external"; $custom = get_post_meta($post->ID, $key, true); ?>
    
    	<?php if(has_post_thumbnail()) {
    			if($content = $post->post_content ) { ?>
    				<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    				<?php the_post_thumbnail(); ?>
    				</a>
    					<?php } else { ?>
    					<a href="<?php $key="featured_external"; echo get_post_meta($post->ID, $key, true); ?>" title="<?php the_title(); ?>">
    					<?php the_post_thumbnail(); ?>
    					</a>
    					<?php }  ?>
    	<?php }  ?>
    	<?php endwhile; endif;?>

    Here’s my sight: http://www.servantdesign.com
    and I would like the 15 pictures in the “Work” Section to link elsewhere.

    So, try something like this:

    <a href="http://yourlink" title="yourtitle">
    <?php the_post_thumbnail(); ?></a>

    PPs. Where would you take your link from?

    I added a custom field where I added the link for each picture, but it doesn’t seem to be communicating back and forth.

    Well, if those images i see are different posts and you don’t need your visitors to see the single view of them, then try this plugin:
    http://wordpress.org/extend/plugins/quick-pagepost-redirect-plugin/

    Ok, I reinserted the original index.php file/ each pic is a different post / and each category (5pics) will link to a separate link.

    Does that plugin work with a post that only includes a featured image? No text, just the featured image.

    Instead of opening your posts’ single view, this plugin redirect you to another url that you decide (no matter if there is some text in there)… I haven’t it installed, but i suggest you to give it a try!

    Yeah, I installed it, but it is still redirecting me back to mywebsite.com/#

    It’s almost like something in the index.php is overriding it…

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Featured Image – Outbound Link’ is closed to new replies.