Forums

Making Featured "Post Thumbnail" Images url Linkable??? (6 posts)

  1. Shadowz
    Member
    Posted 1 year ago #

    I was trying to figure out how to put url links on the featured images "post thumnails", so when you click on the image it takes you to what ever the link is.

    Doesn't look like they exactly have a way to do it easily or maybe? So im guessing i would need to add some code of some sort?

    But i would like for to be as easy as putting the link in a custom field. So for every post i have a featured image on, it can have a different link and no hassle to change.

    I don't really want any HARD code links. Would like to be able to edit it in the wp-admin.

    Hope some one can help

    Thanks.

  2. Shadowz
    Member
    Posted 1 year ago #

    Can any one help, Anything would be grateful?

  3. Shadowz
    Member
    Posted 1 year ago #

    bump!

  4. Shadowz
    Member
    Posted 1 year ago #

    Anyone?

  5. mrmcq
    Member
    Posted 1 year ago #

    Hey there, you could try what I do in my index.php which has a list of the articles, their posts, and set the image to go to the article its associated with like so:

    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" style="glossy">
    <img src="<?php bloginfo(template_url); ?>/thumb.php?src=<?php if (get_post_meta($post->ID, 'thumbnail', true) ) { ?>
    <?php echo get_post_meta($post->ID, "thumbnail", $single = true); ?>
    <?php } else {?><?php echo catch_that_image() ?>
    <?php }?>&h=139&w=206&zc=1" alt="<?php the_title() ?>" />
    </a>

    ...but of course, this is set within the loop: <?php if (have_posts()) :?>.

    You can pull these images from any category or set by tags, etc. I hope this sets you in the right direction!

  6. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    <a href="http://<?php echo get_post_meta($post->ID, 'thumbURL', true) ?>"><?php the_post_thumbnail(); ?> </a>

    for your custom field, the key would always be thumbURL, and the value your link. I've got it set up here so you don't have to type http:// each time, just link.com

Topic Closed

This topic has been closed to new replies.

About this Topic