SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wordpress including files (TEMPLATEPATH or template_url)

    Hi I made my xhtml template and now converting it to wordpress.

    I have some images and flash files that I need to reference from within the html, but not sure whether I should be using the TEMPLATEPATH variable, or bloginfo('template_url'), or some other thing.

    What is the difference between those two, do they have different uses? thanks

  2. #2
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had already read that, but I still cant see the difference between them

  4. #4
    Photoshop Ninja jonnya's Avatar
    Join Date
    Jan 2002
    Location
    Birmingham UK
    Posts
    733
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To cut a long story short:

    PHP Code:
    <?php bloginfo('template_directory'); ?>
    will give you the path to the template directory (without a trailing slash)

    So for example:

    PHP Code:
    <script src="<?php bloginfo('template_directory'); ?>/js/mycooljs.js" type="text/javascript"></script>
    in a template will link to the file 'mycooljs.js' in the directory 'js' in your theme/template directory.

    This I believe is the preferred method, I know this works perfectly!
    Jonnya Freelance Creative
    UK Freelance designer and web developer
    Website | Portfolio | Photoshop Tips

  5. #5
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •