Showing Category Title
-
I’m working on a theme that has different category sections on the home page, like sports, news, commentary, etc. I’m trying to find a way where I can call the category title from the database so if any of the category names change we don’t have to do in the code.
I could I use something like query_post(cat=1) and then just some how call the title?
This is the coded I’m using for the sections right now:
<h2>Category 2</h2> <ul> <?php query_posts("cat=7showposts=6"); if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?> <li><a href="<?php the_permalink();?>"><?php the_title();?></a></li> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?> </ul>
So I’m looking for a way to dynamically call the category title into the h2 tag. Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Showing Category Title’ is closed to new replies.