A simple question on php – category slug
-
Hi,
I’ve been working all day to try and do something very simple but can’t. I’m sure someone will be able to help me in no time.
I’m using thematic and am creating a custom post title. I want to create a new div class which has got the category slug in it.
... $posttitle .= '<div class="icon-'; //I want to insert the category slug here $posttitle .= '">a css background image will go here</div>';From this page I found what I wanted. However, when I do:
$category = get_the_category(); echo $category[0]->category_nicename;then it displays the slug outsite of my posttitle. But if I do:
... $posttitle .= '<div class="icon-'; $category = get_the_category(); $posttitle .= echo $category[0]->category_nicename; $posttitle .= '">a css background image will go here</div>';Then it gives me an error:
Parse error: syntax error, unexpected T_ECHO in /home/peaceand/public_html/blog/wp-content/themes/custom/functions.php on line 39
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘A simple question on php – category slug’ is closed to new replies.