WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Theme does not include a category template (2 posts)

  1. erinfriction
    Member
    Posted 3 years ago #

    The template that I desire to use does not include a category template. I've duplicated the archive.php file and renamed it to category.php, but obviously all that gets me is a list of posts. I'd like it to look like you would expect, with full posts (or excerpts) of each post. I'm crap with php and could use help in figuring out what I need to change.

    This is the present content of the file:

    <?php get_header(); ?>
    <div class="colmask rightmenu blogstyle">
      <div class="colmid">
        <div class="colleft">
          <div class="col1">
            <h2>
              <?php _e('Archives', 'r755'); ?>
            </h2>
            <h3>
              <?php wp_title('',true,'right'); ?>
            </h3>
            <br />
            <!-- Put Archive Dates in a Drop Down -->
            <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
              <option value=""><?php echo attribute_escape(__('Select Month', 'r755')); ?></option>
              <?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?>
            </select>
            <!-- Put Categories in a Drop Down -->
            <?php wp_dropdown_categories(__('orderby=name&show_count=1&show_option_none=Select Category', 'r755')); ?>
            <script type="text/javascript">
      var dropdown = document.getElementById("cat");
      function onCatChange() {
    	if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
    		location.href =
    		"<?php echo get_option('home');?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
    	}
        }
        dropdown.onchange = onCatChange;
    </script>
            <!-- Put A Link To Archive Index Page -->
            <a href="<?php bloginfo('url'); ?>/archives">
            <?php _e('Browse All', 'r755'); ?>
            </a>
            <!-- The Loop -->
            <?php if (have_posts()) : ?>
            <ul>
              <?php while (have_posts()) : the_post(); ?>
              <li><a href="<?php the_permalink(); ?>">
                <?php the_title(); ?>
                </a> <span>(<em>
                <?php the_time('F j, Y') ?>
                -
                <?php comment_type_count('comment'); ?>
                <?php _e('comment/s', 'r755'); ?>
                </em>)</span></li>
              <?php endwhile; ?>
            </ul>
            <?php endif; ?>
            <?php if(function_exists('wp_page_numbers')) { wp_page_numbers(); } ?>
          </div>
          <?php get_sidebar(); ?>
        </div>
      </div>
    </div>
    <?php get_footer(); ?>

    Any help is appreciated!

  2. Chris Lema
    Member
    Posted 3 years ago #

    It looks like your archive.php doesn't actually show posts (only titles). So once you copied it, you would go to the loop (look for this code):

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

    and inside it, below the_title(), you would add,

    <?php the_content('Read more...'); ?>

    At that point, the template should show excerpts or posts (depending on what you selected in the settings).

    Also, if you name the file category-1 or category-2, you can make these category-specific and put text about the start of the loop, and the template will be used only for that category.

Topic Closed

This topic has been closed to new replies.

About this Topic