/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Ritorna la categoria padre di un post * * @return * @param object $post_id */ function get_parent_category( $post_id ) { foreach( $cats as $key => $cat ) if( $cat->parent == 0) return $cat; return null; }