Post/Page Image Src HTML not Visual (11 posts)

  1. jeremi_liwanag
    Posted 3 years ago #


    I want to use the <img src="images/image1.jpg /> code on my wordpress pages.

    not in backend but inside the "html wordpress post page" ( the one where you write the articles).

    because if it's backend it will be like this right?

    <img src="<?php bloginfo('template_directory'); ?>/images/image1.jpg />

    I dont want to upload the images,(because they are already in my images folder). i want to get it directly in my images folder (no upload media stuff)

    because if i upload it, the src will be like this


    is there any shortcut for this one?
    because i'm trying to upload hundreds of tiny images, and i already have my html code setup

    if i can just copy paste it into the "html publish page" that will be great!

    Jeremi L.

  2. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

    Have you access to the directories of your website?

  3. jeremi_liwanag
    Posted 3 years ago #

    What do you mean access? I'm using WordPress locally for now. I'm using WAMP

  4. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

    Can you create a directory within your theme, name it relevantly and put all your images in there? Then you can specify that directory in your URLs.

  5. jeremi_liwanag
    Posted 3 years ago #

    Yes, i think i already have created a folder inside my theme

    WordPress/wp-content/themes/myTheme/images/ (this is where my images at)

    So the img src will be like

    <img src="images/image1.jpg" /> right? but this one doesn't work

  6. Andrew Nevins
    Forum moderator
    Posted 3 years ago #


  7. jeremi_liwanag
    Posted 3 years ago #

    Tried /wp-content/themes/yourThemeName/images/image1.jpg

    doesn't work :`(

    i wonder if there's a plugin that can do that

    instead of http://localhost/wordpress/wp-content/uploads/2012/10/image1.jpg

    it will accept


    i really need a help on this ..

    because i have a lot of mini icons that are in unordered list. do i have to upload them and copy paste the url one by one? that will take me at-least a day to complete it.

  8. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

    Did you try replacing yourThemeName with your actual theme name?

  9. jeremi_liwanag
    Posted 3 years ago #

    Yes i did,

    actually it's like this


    also tried this










    none of them seems to work

  10. Xaliber
    Posted 3 years ago #

    I think this might be a bit overkill, but you could try using shortcode.

    Add this to your functions.php:

    // Create the shortcode
    function template_url( $atts, $content = null ) {
        return '<img src="'. get_template_directory_uri() .'/'. $content .'" alt="" />';
    // Add as shortcode
    add_shortcode("template", "template_url");

    To use it, you could simply type this in your WordPress visual editor:

    Which would result as:
    <img src="http://yoursite.com/wp-content/themes/yourtheme/images/image1.jpg" alt="" />

    This isn't tested though, so it may contain errors. But the basic should look like that. :)

  11. ojassvi
    Posted 3 years ago #

    Thanks Xaliber. Great piece of code. It worked out smoothly.

Topic Closed

This topic has been closed to new replies.

About this Topic