vogueinc
Member
Posted 3 years ago #
Ok I read on this forum that you use <?php bloginfo('template_directory');?> that, but where do you put it. Link in the pages where does it go. If someone can give me an example of what the page with the codes hsould look like that would be very very helpful! Thanks!
Quote from TDude
Naaah. Wp and the good folks behind it are kinder than you think. To get to your template's root (ie "virtual" site root), just copy this before your file or directory name in the anchor link:
<?php bloginfo('template_directory');?>
Check the header.php and the link to style.css in use on the default theme.
Instead of using a full URL in your template code for an image (ie http://www.mycoolwebsite.com/wp-content/themes/my_cool_theme/images/my_cool_header_image.jpg) you would use <?php bloginfo('template_directory'); ?>/images/my_cool_header_image.jpg.
The advantage of this a modular or portable code. If your domain ever changes, you wouldn't have to alter your template code. Not always necessary, but it's a good habit.
vogueinc
Member
Posted 3 years ago #
So doing this and having the universal name for the images, I can make it change themes and what not?
I don't understand your question. But, <?php bloginfo('template_directory'); ?> is a "universal" code for your current theme's directory, wherever your website is.