Created
July 11, 2015 15:20
-
-
Save pablocattaneo/cbdf2123e8ed8b927ffa to your computer and use it in GitHub Desktop.
Returns categories names used in the current post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// returns categories names used in the current post | |
$term_list = wp_get_post_terms($post->ID, 'category', array("fields" => "names")); | |
foreach ($term_list as $categoryName) { | |
echo " <h1>$categoryName</h1>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment