• Resolved scott5150

    (@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:

    echo $_SERVER['DOCUMENT_ROOT']

    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: https://sterling-testing.com/wp-content/uploads/2013/10/

    Thanks
    | scott

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter scott5150

    (@scott5150)

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

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

    Thread Starter scott5150

    (@scott5150)

    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?

    Thanks.

    Thread Starter scott5150

    (@scott5150)

    I ran

    echo bloginfo('template_url');

    That tells my my template URL is: https://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 …

    Thanks:
    Scott

    Thread Starter scott5150

    (@scott5150)

    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?

    thanks

    Thread Starter scott5150

    (@scott5150)

    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 ‘Trouble identifying root directory?’ is closed to new replies.