ilDavid.com

Get top level category of a post WP function

29 lug 2010

Let's say you have a post under a subcategory and you want to show only the top level category that is assigned to the post, you can use this function: [php] function GetTopLevelCategory() { $category = get_the_category(); $parent = $category[0]->category_parent; while($parent...» Leggi l'articolo

Tags: