/ Published in: PHP

Mostrar un link a una subcategorÃa, dependiendo de la categorÃa superior. category_parent es igual al id de la categorÃa superior. Sirve sólo cuando el post tiene una categorÃa hija de la categorÃa superior.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php foreach((get_the_category()) as $category) { if($category->category_parent == 193): echo '<em>por <a href="/archives/category/'. $category->category_nicename.'">' . $category->cat_name . '</a></em>'; endif; } ?>
Comments
