• Resolved Perkin5

    (@perkin5)


    In order to load an image in a page, I am using <?php echo get_bloginfo(‘template_directory’); ?> to get the template url but instead of giving me a uri the code snippet is being rendered as plain text. I alsi tried <?php echo ‘TEST’; ?> with the same result

    I’m using the Underscores theme and WAMP as a local server

    What can be going on?

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

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    In which file are you putting this code?

    Thread Starter Perkin5

    (@perkin5)

    I entered it in the Page Editor so it would have been put in the database. Is there a wp database security setting I wonder to prevent code injection?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    The page editor doesn’t render PHP. Are you creating your own theme?

    Thread Starter Perkin5

    (@perkin5)

    Yes, I’m creating a theme based on Underscores.

    If the page editor doesn’t render php, how do I pull in an image from my theme image folder? Surely I need to get the theme directory url with a wp template tag?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Generally assets that you’re adding into the page editor should be things from the ‘uploads’ directory. Assets from the ‘theme’ directory should be added into templates.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You can edit a template in Appearance > Editor
    https://codex.www.ads-software.com/Appearance_Editor_Screen

    Thread Starter Perkin5

    (@perkin5)

    Ah – new to wp and hadn’t appreciated that.

    Actually I prepare all content in Subime Text 2 and cut and paste into the Page Editor so it’s easy to get carried away?

    Thanks for responses

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘PHP being rendered as plain text’ is closed to new replies.