Support » Fixing WordPress » Custom Fields and URLs

  • Hi. I’m trying to do some work with Custom Fields, but I clearly do not fully understand them and can’t really find a plug-in that does what I want. So here are my issues:

    1. I have a custom field called URL which is an address I want to link to. The problem is that I want that link to wrap around an image I put in the post. So I write my post, put in a pic, enter an address in the URL custom field and then the output would be something like:
    <a href="URL CUSTOM FIELD LINK"><img src="from the post" /></a>

    2. The second issue I have is that I have another custom field, Via. It’s also for a web address, but what I can’t figure out how to get WordPress to automatically turn it into a functioning link. Additionally, I’d imagine the PHP would have an if/then statement so that if there is no Via in that particular post, it doesn’t try to show anything.

    I hope I was able to explain that well enough. Thanks for any help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Have you seen this plugin ? Get Custom Field Values

    I have got it working on my site with images but I was not able to figure out how to include php code within it.

    Thanks arcater, that plug-in was just what I needed to deal with my second problem.

    However, I still can’t figure out how to have that custom field url wrap around my image. I thought this would be something I could set-up in the template, but clearly it’s going to involve some sloppy hacking. Any thoughts?

    Not sure what you mean by have that custom field url wrap around my image ?

    Maybe what you want is what I just got done doing on my site. you can see it here. This involves no plugin. Assumes you have a custom field called “thumbnail” with a value of just the file name, not the full path.

    <a href="<?php the_permalink() ?>"<img align="left" title="<?php the_title() ?>" alt="<?php the_title() ?>" border="2" src="<?php echo get_post_meta($post->ID,'thumbnail', true); ?>"></a>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Fields and URLs’ is closed to new replies.