Search resulty by category
-
Hi,
I’m trying to get something like this on my search results page…
Cat 1(count)
Post name
Post nameCat 2(count)
Post name
Post nameCat 3(count)
Post nameCat 4(post)
Post nameThis is what I have for now:
<?php $categories = get_categories(); $mycatid = $item->object_id; $category = get_category($mycatid ); foreach($categories as $category) { echo $category->name; echo $category->count; ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_title(); ?> <?php endwhile; ?> <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?> <?php else : ?> <h2 class="error">Not Found</h2> <?php endif; ?> <?php } ?>
- The topic ‘Search resulty by category’ is closed to new replies.