Hi...
i m setting up a new blog.
i want to put all the content(images) of a particular categ in separate folder. which is named as categ-slug name
Path is wp-content/uploads/categ-slug/
how can i get the slug name in the image path?
i want to use this code
<textarea rows="2" cols="80"><img src="http://www.mysite.com/wp-content/uploads/<category slug folder>/imagename.jpg"></textarea>
i want to use this in the loop for each post
so that it get each post's categoery & display dat category-slug in the image src path.
how can i do that?
thanks in advance
I used with in the loop
<?php $category = get_the_category( ); ?>
& in the image path
<img src="http://www.mysite.com/wp-content/uploads/<?php echo $category[0]->cat_name; ?>/imagename.jpg">
but it returns category name
i want category slug
so try to use
<img src="http://www.mysite.com/wp-content/uploads/<?php echo $category[0]->category_nicename; ?>/imagename.jpg">
but its not returning category name
plz HELP !!!
i was waiting from long time
in this "support forum" for Support which was missing
thanks for replying [:)]
its returning path as
<img src="http://www.mysite.com/wp-content/uploads//imagename.jpg">
It's a volunteer support forum. And 20 hours isn't all that bad.
1) Are you using this in The_loop?
2) Does cat_ID spit out anything?
It also helps if you toss your URL out there :) Sometimes looking at a site gives people hints.
This is a stab at trying to keep it all together based on the suggestion from the codex:
<?php
$category = get_the_category();
echo '<img src="http://www.mysite.com/wp-content/uploads/' . $category[0]->category_nicename . 'imagename.jpg" />';
?>
thanks
code which i used working now
i think sum page refresh or cache problem !!!