Support » Fixing WordPress » use bloginfo() to link to images from media library

  • I’d like to avoid using absolute URLs to link to images uploaded via the media library. I’m aware that in some cases I can use
    <img src="<?php bloginfo ('template_url'); ?>/uploads/2011/11/sample.jpg"/>

    or

    <img src="<?php bloginfo ('stylesheet_url'); ?>/images/uploads/2011/11/sample.jpg"/>

    …but it doesn’t always work when I’m using custom themes.

    I’ve read over http://wordpress.org/support/topic/any-way-to-use-bloginfo-to-link-to-uploads-directory?replies=8 a few times, but it isn’t quite making sense to me and I’ve not been able to implement this successfully.

    Can someone offer an alternate explanation?

Viewing 1 replies (of 1 total)
  • Adam

    (@adamgoldman47yahoocom)

    figured it out?

    How about:

    <img src="<?php bloginfo ('url'); ?>/wp-content/uploads/2011/11/sample.jpg"/>url
Viewing 1 replies (of 1 total)
  • The topic ‘use bloginfo() to link to images from media library’ is closed to new replies.