Enjoy the free book:
Wordpress & Ajax
Showing posts with label wordpress. Show all posts
Showing posts with label wordpress. Show all posts
how to get category name by post-id?
if you want get name category with post_ID, you can use function: wp_get_post_categorie
<?
$post_categories = wp_get_post_categories($post->post_id);
$cats = array();
foreach($post_categories as $c){
$cats_r = get_category( $c );
echo $cats_r->name;
}
?>
good luck!
<?
$post_categories = wp_get_post_categories($post->post_id);
$cats = array();
foreach($post_categories as $c){
$cats_r = get_category( $c );
echo $cats_r->name;
}
?>
good luck!
Subscribe to:
Posts (Atom)