Support » How-To and Troubleshooting » [Resolved] Trouble identifying root directory?

[Resolved] Trouble identifying root directory?

  • scott5150


    I am trying to have all site images linked via relative URL so that the site can be easily moved from development area to live. I’ve tried all the usual methods of dynamic linking that I’ve come across here in the WP Documentation but they don’t seem to work in this instance.

    The only thing I can imagine going wrong is the dynamic linking methods show below are all calling the wrong path?

    <a href="#"><img src="<?php bloginfo('template_url'); ?>/wp-content/themes/Astrum/images/logos-arcat.gif" class="float-left home-logo-pad" alt="ARCAT" width="164" height="163"></a>
    <a href="#"><img src="<?php echo get_stylesheet_directory_uri() ?>/images/logos-arcat.gif" class="float-left home-logo-pad" alt="ARCAT" width="164" height="163" /></a>
    <a href="#"><img src="<?get_template_directory_uri() ?>/images/logos-arcat.gif" class="float-left home-logo-pad" alt="ARCAT" width="164" height="163" /></a>

    I’m wondering how I can determine my images path? Is there a function I can run to determine this? For instance:


    Being new to PHP I wouldn’t be sure where to even run something like that. I could probably just paste it into the template_home.php, couldn’t I?

    The actual relative path to my images is here: /public_html/wp-content/themes/Astrum/images

    I’ve noticed most people use this link which seems to be an alias to the same directory: /public_html/wp-content/uploads/2013/10

    I’ve tried using both those paths in my dynamic link to no avail. The absolute URL for images would be: http://sterling-testing.com/wp-content/uploads/2013/10/

    | scott

Viewing 7 replies - 1 through 7 (of 7 total)
  • esmi


    Forum Moderator



    I’m the same poster. This one asks for some PHP to determine where to set my dynamic links to. Thanks.



    Forum Moderator

    If this is related, it would be better if you continued with your existing topic instead of creating a new one.



    Nothing was happening on the other one. This is very important, so, in this one I’m asking for other information that I didn’t request in the first post. It would be better to continue with this post. It more accurately describes my dilemma.

    Should I delete the other one?




    I ran

    echo bloginfo('template_url');

    That tells my my template URL is: http://sterling-testing.com/wp-content/themes/Astrum

    However most of my images were uploaded by wordpress to this URL: /public_html/wp-content/uploads/2013/10

    SO in order to use the images at the first URL, one would think all I would need to do would be to upload all my images into the first directory, right? Still didn’t work when using:

    <a href="#"><img src="<?php bloginfo('template_url'); ?>/images/logos-arcat.gif" class="float-left home-logo-pad" alt="ARCAT" width="164" height="163"></a>

    Anybody know what’s happening here? Seems freaky to me, but then again, I’m fairly new to the world of wordpress.

    Maybe some of the trouble is because I am inserting this code into the page editor window? I don’t know … I noticed it freaks out on characters like the Greater than Symbol … even though I used the entity …




    I gather you cannot use PHP in the editor Window? Maybe that’s why the dynamic image linking method will not work. I keep trying to use it in the Editor WYSIWYG window.

    How can I dynamically link images when they are inserted via the editors window?


    SO, the problem ended up being that I was attempting to use the dynamic image location method (which contains PHP) from with the editor’s window.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Trouble identifying root directory?’ is closed to new replies.