[resolved] Image Src working on index page but not on other pages (6 posts)

  1. jboarini
    Posted 3 years ago #

    When I insert an HTML image tag in index.php using the following code, it shows up with no problem:

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

    However, when I edit a page using the dashboard and paste that same code in the HTML editor, the image stops showing up.

    Please help!

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    You cannot use PHP in either of the WordPress editors. You have to use hard coded urls.

  3. Jay Hoffmann
    Posted 3 years ago #

    PHP is automatically parsed in the dashboard so it does not render PHP code very well. This is for good reason, it is generally not a good practice.

    If you are trying to upload images, you can just use the Media Uploader located directly above the HTML Editor window in your dashboard or you can try searching for a plugin that will allow you to do this.

  4. jboarini
    Posted 3 years ago #

    Ok, that clears it up. I have a gallery that I really like in my regular page, here:


    I assume then that the best solution would be to simply create a page template and use that one correct? Thanks for your help!

  5. Rev. Voodoo
    Posted 3 years ago #

    Yeah, if you are going to custom set up pages with pictures, unique functionality, etc., a template is the way to go

  6. jboarini
    Posted 3 years ago #

    Excellent, thanks for your help guys!

Topic Closed

This topic has been closed to new replies.

About this Topic