I am attempting to call a PHP sylesheet in WP functions. I have two pieces of code that need to call a specific stylesheet named tagmap.css
echo '<link rel="stylesheet" href="<?php bloginfo("template_url"); ?>/tagmap.css" type="text/css" media="screen" />';
Here is what XHTML validator says:
[[LINK href="http://validator.w3.org/check?uri=http%3A%2F%2Flucaswynne.com%2F547-2%2F&charset=%28detect+automatically%29&doctype=Inline&group=0&user-agent=W3C_Validator%2F1.1"]]http://validator.w3.org/check?uri=http%3A%2F%2Flucaswynne.com%2F547-2%2F&charset=%28detect+automatically%29&doctype=Inline&group=0&user-agent=W3C_Validator%2F1.1[[/LINK]]
Be the first to fix it and you'll get your money.
Chris Bavota answers:
Note that <em>bloginfo("template_url")</em> is deprecated. You should use <em>get_template_directory_uri()</em>.
So your snippet should look like this:
echo '<link rel="stylesheet" href="'.get_template_directory_uri().'/tagmap.css" type="text/css" media="screen" />';
Baki Goxhaj answers:
Here:
echo '<link rel="stylesheet" href="' . bloginfo("template_url") . ' /tagmap.css" type="text/css" media="screen" />';
Pippin Williamson answers:
You shouldn't do it that way. Use the built-in WordPress function to include a style sheet:
wp_enqueue_style('tagmap-styles', get_template_directory_uri() . '/tagmap.css');