The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

use bloginfo() to link to images from media library (2 posts)

  1. Runtheball
    Posted 4 years ago #

    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"/>


    <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?

  2. Adam
    Posted 4 years ago #

    figured it out?

    How about:

    <img src="<?php bloginfo ('url'); ?>/wp-content/uploads/2011/11/sample.jpg"/>url

Topic Closed

This topic has been closed to new replies.

About this Topic