WordPress Template Directory

How can I get this to work? Thanks in advance!!! I think the first echo should work but it doesn't...it prints out the URL in text instead of showing the image...

<?php
      if (is_tree(18)) {
         echo '<img src="' . bloginfo('template_directory') . '/img/icon-trans.png" />';
      } else if (is_tree(20)) {
          echo "<img src='/~cecmsite/wp-content/themes/commonwealth/img/iconIndustrial-trans.png' />";
      } else if (is_tree(22)) {
          echo "<img src='/~cecmsite/wp-content/themes/commonwealth/img/iconInstitutional-trans.png' />";
      } else if (is_tree(24)) {
          echo "<img src='/~cecmsite/wp-content/themes/commonwealth/img/iconComm-trans.png' />";
      } else if (is_tree(27)) {
          echo "<img src='/~cecmsite/wp-content/themes/commonwealth/img/iconService-trans.png' />";
      } else if (is_tree(39)) {
          echo "<img src='/~cecmsite/wp-content/themes/commonwealth/img/iconTraffic-trans.png' />";
      } else {
      echo "";
      }
      ?>

Answers


Instead of using bloginfo('template_directory') use get_bloginfo('template_directory')


Need Your Help

boost ptime to unix timestamp conversion error

c++ datetime boost

I'am using boost date time to calculate the unix time for a particular date.

mysql count group by order by optimization

mysql group-by sql-order-by

I have a table to store tag name for posts

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.