Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Avoiding Template Directory Function

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #152206
    Steven Morgan
    Participant

    I am wondering if there is a way in WordPress to have my theme always use the root of the theme and not the WP directory.

    For instance every time I hard code an image in my theme I want to use:

    < img src=” images / logo.png” />

    That will look in the images folder at the root of the WordPress directory and I want it to use my theme directory.

    Instead I have to use:
    < img src=” <?php echo get template directory_uri( ); ? > /images/logo. png” />

    Is there anyway to do this?

    P.S. sorry about the weird spacing, WordPress thought I was putting code in there.

    #152223
    __
    Participant

    I am wondering if there is a way in WordPress to have my theme always use the root of the theme and not the WP directory.

    Yes; that’s exactly what get_template_directory_uri( ) does.

    I want to use: <img src=”images/logo.png”/>

    You can’t provide the wrong path and get the correct result, no.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.