WordPress.org

Ready to get started?Download WordPress

Forums

Template tag for queried category to show within category query loop? (2 posts)

  1. mkjar
    Member
    Posted 3 years ago #

    Hello I have a question about a query I am loading - I am using a combo of 'catch that image' and 'timthumb' script to make an list of posts (with thumbnails ) of each sub category - on a category page. The image code works fine, but because I have several sub categories on one page (say an image recipe index with different sub categories - or a portfolio with different work subcategories ) changing all the headings takes awhile.

    My question is - there a way to declare the category heading within the query loop? I have been just putting the ul and and the category name outside EACH loop (I sometimes have 20-40 subcategory loops on one page) - and - I know I can echo the ul's inside the loop, but I was wondering is there a template tag for calling up the queried category within the queried loop ?

    How I have been doing it:

    <h2>CATEGORY HEADING MANUALLY WRITTEN HERE</h2>
    <ul>
    <?php $my_query = new WP_Query('cat=sub-category-id&showposts=-1'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <li>
    <a class="gobright" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
    <img class="archive_image_thumbnail" src="<?php bloginfo('template_directory'); ?>/scripts/thumb.php?src=<?php echo catch_that_image(); ?>&w=140&h=140&zc=1" alt="<?php the_title(); ?>" />
    <?php the_title(); ?>
    </a></li>
    <?php endwhile; ?>
    </ul>

    ps -I know that:
    <?php single_cat_title(); ?>
    Calls up the category title - but only for the current page and outside of any loop - so I got stuck?

  2. vtxyzzy
    Member
    Posted 3 years ago #

    Will the get_cat_name() function work?

Topic Closed

This topic has been closed to new replies.

About this Topic