WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Image Src working on index page but not on other pages

[Resolved] Image Src working on index page but not on other pages

  • jboarini

    @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

    @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.

    jboarini

    @jboarini

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

    jonathanboarini.com/works.html

    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

    jboarini

    @jboarini

    Excellent, thanks for your help guys!

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