Support » Fixing WordPress » Image Src working on index page but not on other pages

  • Resolved jboarini


    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!

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


    Forum Moderator

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

    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.

    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!

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

    Excellent, thanks for your help guys!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Image Src working on index page but not on other pages’ is closed to new replies.