Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Better custom field links

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28875
    emma
    Participant

    Hello

    Thanks to the almighty custom fields I can use and adjust my post images just the way I want them. However, the other day I moved my site to a new url only to realize that I now have to update all my image urls on the entire site! (doh)

    I tried using php to create smarter links but that doesn’t seem to work. Is there a clever way to create links using custom fields?

    #74890
    TheDoc
    Member

    Hmmmm… you could do something like…

    <img src="<?php bloginfo(‘url’); ?>/<?php echo get_post_meta($post->ID, ‘mood’, true); ?>" />

    And you only put the following in your custom field:

    wp-content/uploads/2010/01/image-name.jpg

    So the full output would be:

    <img src="http://www.yourblog.com/wp-content/uploads/2010/01/image-name.jpg&quot; />

    #74994
    emma
    Participant

    Good thinking. Thanks Doc.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.