Hello guys;
I'm working on a custom tags page and I have one little problem that I couldn't figure out!
I put this code in the theme's functions.php
function get_tgrid() {
$wpbtags = get_tags();
$output .= '<div class="grid"><div class="tagslist"><ul class="tagsgrid">';
foreach ($wpbtags as $tag) {
$output .= '<li class="item"><a href="'. get_tag_link($tag->term_id) .'" style="background-image: url("/wp-content/uploads/tags/' . $tag->slug . '.jpg")"><span class="item-name"><span class="count">'. $tag->count .'</span><span class="item-name">'. $tag->name . '</span></span></a></li>';
}
$output .= '</ul></div></div>';
return $output;
}
The problem is instead of giving the intended output which is like:
<a href="http://myblog.com/tag/example/" style="background-image: url("/wp-content/uploads/tags/example.jpg")"><span class="item-name"><span class="count">1</span><span class="item-name">EXAMPLE</span></span></a>
it gives me this:
<a href="http://myblog.com/tag/example/" style="background-image: url(" wp-content="" uploads="" tags="" example.jpg")"=""><span class="item-name"><span class="count">1</span><span class="item-name">EXAMPLE</span></span></a>
I'm a php newbie and I'd appreciate a little help!
Thanks.