WordPress.org

Ready to get started?Download WordPress

Forums

TEMPLATEPATH images direcotry? (5 posts)

  1. XraySierra
    Member
    Posted 7 years ago #

    In my theme I put <img src="/wp-content/themes/my-theme/images/whatever.jpg">

    Is it possible to setup something like <img src="<?php TEMPLATEPATH ?>/images/whatever.jpg">

  2. spencerp
    Member
    Posted 7 years ago #

    Example of what I use, is this:
    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/title-icon.png" alt=""/>

    I hope this helps. =)

    spencerp

  3. dsamuel
    Member
    Posted 7 years ago #

    bloginfo('stylesheet_directory') doesn't work for me, but get_stylesheet_directory() does - at least it gives me the absolute path to the current theme directory. TEMPLATEPATH provides a relative (to http://) path as well.

    ---------------------
    Development

  4. SAV
    Member
    Posted 7 years ago #

    (i do this way:
    <img src="<?php echo(TEMPLATEPATH)?>/images/banner1.jpg" />
    regards)
    NOP don't work in Firefox.
    use spencerp solution.

  5. westbym
    Member
    Posted 7 years ago #

    Try this:

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

    example:

    <img src="<?php bloginfo('template_directory'); ?>/images/title-icon.png" alt=""/>

Topic Closed

This topic has been closed to new replies.

About this Topic