Support » Themes and Templates » Post/Page Image Src HTML not Visual

  • Hi,

    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.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator Andrew Nevins


    Forum moderator

    Have you access to the directories of your website?

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

    Moderator Andrew Nevins


    Forum moderator

    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.

    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

    Moderator Andrew Nevins


    Forum moderator


    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.

    Moderator Andrew Nevins


    Forum moderator

    Did you try replacing yourThemeName with your actual theme name?

    Yes i did,

    actually it’s like this


    also tried this










    none of them seems to work

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

    This isn’t tested though, so it may contain errors. But the basic should look like that. 🙂

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Post/Page Image Src HTML not Visual’ is closed to new replies.