WordPress.org

Ready to get started?Download WordPress

Forums

What's the image path for a new theme? (3 posts)

  1. parthatel
    Member
    Posted 6 years ago #

    A simple noob question. I created a new theme and need to know the path to the image folder of the theme.

    Say my folder for the theme is THEME1, and inside I have folder IMAGES, then I know my path would be

    http://mywebsite.com/blog/wp-content/themes/THEME1/IMAGES/

    but instead of writing all that out, is there a php function where I can just write something like

    <?php get(TEMPLATEPATH . 'IMAGES/image.gif') ?>

    (I just made up the code above, don't know if it works, but I'm looking for something like that).

    I looked around, I know this is very basic, but couldn't find the answer. Thanks.

  2. kgagne
    Member
    Posted 6 years ago #

    I believe

    <?php bloginfo('template_directory'); ?>

    does this.

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    bloginfo('stylesheet_directory'); is the more usual approach. Look at this example from the default theme's header.php:

    "<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg"

    The get_stylesheet_directory_uri() function will also return the base URI in question.

    But yes, the "template" is basically the same thing in almost all cases.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags