News Update :
Home » » Information on the post / page - Category

Information on the post / page - Category

By: Unknown on Monday 23 February 2015 | 13:05

To add to the loop (even if the information is not used in the loop):


<?php $categories = get_the_category();
$image=$categories[0]->slug;
$nom=$categories[0]->cat_name;?>
If it does not work:


 








<?php foreach((get_the_category()) as $category) {
   var_dump($category);
   $image=$category->slug;
   $nom=$category->cat_name;
}?>
If a page category:


<?php $categories = get_category( get_query_var( 'cat' ) );
$image=$categories->slug;
$nom=$categories->cat_name; ?>
Then reuse the information in the variables, it remains only display:


<?php echo $nom;?>
Want to see the information in the table? Very well!


<?php var_dump($categories); ?>
 
Contact Us | Privacy policy | Term of use | Advertise with Us | Site map
Copyright © 2011. Blogging Brain . All Rights Reserved.
Design Template by Blogging Brain | | Powered by Blogger