Many people want to know about post category and know more information current category.
Some time we need to use the first category of wordpress post. As we know we can define the multiple category to single article. So if we want retrive the wordpress category then we will get the result in simple php array format. Using that array we can easily extract the first category of post.
In this post I will show how we can achieve that. Using following code we can get the first category ID.
< ?php $category = get_the_category(); $currentcat = $category[0]->cat_ID; ?>
Using following code we can extract the first category name from the wordpress post.
< ?php $category = get_the_category(); $currentcat = $category[0]->cat_name; ?>
Above code we can use only in the loop but using the following code we can extract the category
outside the loop also
<?php global $post; $categories = get_the_category($post->ID); $currentcat = $category[0]->cat_ID; ?> <pre>
same like that.. cat name
<?php global $post; $categories = get_the_category($post->ID); $currentcat = $category[0]->cat_name; ?> <pre>
Incoming search terms:
- get category name by post id
- wordpress get category name
- how we can get post category id in wordpress
- how to get catgeory name by post id
- wordpress api categories
- wordpress qtranslate get category title
- extract category name wordpress
- get the first category
- wordpress 3 3 get cat name by id
- wordpress first slug category name
- wordpress get first categoruy
- wordpress get first category
- wordpress get first category id
- wordpress get post category id from database
- wordpress get the first category
- wordpress php first category
- wordpress select first category
- coding for get category name from post id
- php post id or name
- how to show title of first category wordpress







Amazing site, where did you come up with the information in this summary? Im glad I found it though, ill be checking back soon to see what other articles you have.
Good, your blog very useful for me, i will book mark it, thanks!
This is a outstanding post, but I was wondering how do I suscribe to the RSS feed?
Please click on right side email icon for subscribe the RSS feed.
Can I make a suggestion? I think youve got something good here. But what if you added a couple links to a page that backs up what youre saying? Or maybe you could give us something to look at, something that would connect what youre saying to something tangible? Just a suggestion.
I was searching for How to get a book published in Canada, and found your website. Very thoughtfull.It should be very much helpfull. Thanks for information!
Hey, often excellent to see other folks through the hole world in my searching, I really appreciate the time it should have taken to put together this cool site. best regards
Where may I experience monetary value of segments as well as repairs as Audi A3 2007? I’m reasoning of buying an Audi A3 2007 2.0 FSI , usually aspirated. I’d likes To acknowledge where I may experience actual info by what this may price how to repari if A/C broke down, or To substitute shocks, repair a console etc etc. also if everyone thinks this is a capital eating car to grounds of repairs Please let me recognise also. Many thanks
Intriguing post. I have been searching for some good resources for solar panels and discovered your blog. Planning to bookmark this one!
I’ve been checking your blog for a while now, seems like everyday I learn something new
Thanks
I REALLY liked your post and blog! It took me a minute bit to find your site…but I bookmarked it. Would you mind if I posted a link back to your post?
Thanks for the hack. This is exactly what I was looking for. An example and css styling would have made the post much more useful. I need to get the first category of the post on homepage. This will definitely help me out.