Template Directory Shortcut

Fundamental 33 views
0
0 Flares 0 Flares ×

This provides you a quick way to provide a link directly to your theme folder.

Side-note: When I first started tweaking WordPress themes I would have to write out the entire path to the theme folder each time. This little snippet here has saved me so much time!

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

Linking to Javascript File in Theme Folder

<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/script.js"></script>

In layman’s terms, the above is the equivalent of http://yoursite.com/wp-content/themes/theme-name/

For Reference:

Function Reference: bloginfo

Posted in Wordpress

Discuss:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

No Trackbacks.

Login

Register | Lost your password?
0 Flares Twitter 0 Facebook 0 Google+ 0 0 Flares ×