Get custom category name or id on archive.php page Wordpress -


how can "fetch" custom category name or id on archive.php page. when i'm on page template, how can know custom category posts showing?

use get_queried_object(); retrieve currently-queried object.

in taxonomy term case:

//custom taxonomy project_type, custom term web-design $obj = get_queried_object();  echo '<pre>'; print_r( $obj ); echo '</pre>'; 

displays following:

stdclass object (     [term_id] => 56     [name] => web design     [slug] => web-design     [term_group] => 0     [term_taxonomy_id] => 56     [taxonomy] => project_type     [description] => lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.     [parent] => 0     [count] => 0 ) 

hope helps!


Comments

Popular posts from this blog

c++ - Linked List error when inserting for the last time -

java - activate/deactivate sonar maven plugin by profile? -

java - What is the difference between String. and String.this. ? -