Forums

Using one Category Template for Multiple categories (2 posts)

  1. artguy13
    Member
    Posted 2 years ago #

    hello to all of you wonderfully smart wordpress people!

    I have a question / challenge that I can not wrap my brain around.

    What I have:

    I am developing a website that has a number of categories. Each category page needs to have different content.

    The challenge is, I want the admin of the site to be able to add additional categories in the future and not have to create new template files (as they know nothing about programming)

    What I would like to know / learn how to do is this...have the category template determine what ID it is currently in, and to auto fill this ID in the loop to determine content:

    here is the code I have so far:

    <?php get_header(); ?>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div id="gallery_content">
    <div id="sec_nav_caption">
    <?php single_cat_title(); ?>
    </div>
    <div id="description">
    <?php the_excerpt(); ?>
    </div>

    <div id="left_big_vert">
    <?php the_content(); ?>
    </div><!-- ends left_big_vert -->

    //THIS THUMB GALLERY WILL CHANGE ACCORDING TO CATEGORY

    <div id="gallery_thumbs_small">
    <ul id="icon_menu">
    <?php if (function_exists('put_cat_icons'))
    put_cat_icons(wp_list_categories('title_li=0&echo=0&child_of=3'),'icons_only=true');
    ?>

    </div>

    <div id="hor_nav">

    // THIS MENU WILL CHANGE - by Category
    <ul id="menu">

  2. Apartments
  3. <span class="style1">Lofts</span>
  4. Houses
  5. Townhouses
  6. </div><!-- End hor_nav -->

    </div><!-- end gallery_content -->

    <?php endwhile; ?>

    <?php endif; ?>

    <?php get_footer(); ?>

    PLEASE PLEASE if someone can help me IT WOULD BE AWESOME!!!!

  • MichaelH
    Volunteer
    Posted 2 years ago #

    You can use the Conditional Tag is_category() or $cat = get_query_var('cat'); will also give you the current queried category.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags