show posts of a subcategories
-
I′m using this code to show of child subcategories of categorie 12. I′m using type plugin to show imagem from custom type. Ok. It runs ok. So if I click in one of this subcategories, It goes to a news page with posts of subcategory, but how can I do when you click in a image or name of this post, go to the post. Now, if I click in one of the post, goes to the same page.
The link of childs of id=12:
https://www.ashermedical.com/site/?cat=12if you click in “CIRURGIA GERAL”, you go to a page with all products/posts of this subcategory:
https://www.ashermedical.com/site/?cat=22
But how Can I do when you click in one of this products/posts, goes to it single post like:
https://www.ashermedical.com/site/?p=283
The code I′m using:
<?php foreach((get_the_category()) as $childcat) { if (cat_is_ancestor_of(12, $childcat)) { echo '<span class="cat-links"><h3 class="entry-title"><a href="'.get_category_link($childcat->cat_ID).'">'; echo $childcat->cat_name .'</a></h3></span>'; echo '<div id="thumb-category"><a href="'.get_category_link($childcat->cat_ID).'">'; echo do_shortcode('[types field="imagem-1" alt='.($childcat->cat_ID).' title="'.get_category_link($childcat->cat_ID).'" size="thumbnail" align="none"]') . '</a><div>'; }} ?> <?php endif; ?>
Thanks a lot for any help!
- The topic ‘show posts of a subcategories’ is closed to new replies.