WordPress.org

Support

Support » How-To and Troubleshooting » Show post category next to post date on Archive page.

Show post category next to post date on Archive page.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Tip: Some themes do this by default and are Open to the Public…while we cannot point you to a theme specifically, look for one with theme options..

    I want to continue to use this same theme. Here is a copy of the archives.php file for the Manifest theme:

    [please mark any posted code – http://codex.wordpress.org/Forum_Welcome#Posting_Code – the code below was posted unmarked and is partially corrupted]

    <?php
    /*
    Template Name: Archives
    */
    ?>
    
    <?php get_header(); ?>
    
    <div id="coreContent">
      <div id="archives" class="single hentry">
        <h2 class="entry-title"><?php the_title(); ?></h2>
    
        <h3>Works</h3>
    
        <?php query_posts('cat=&showposts=15'); ?>
        <ul id="recentPosts">
    
        		<?php while (have_posts()) : the_post(); ?>
    
    <li>
             <a>" rel="bookmark"><?php the_title(); ?></a>
             <div class="postDate"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php the_date('F j, Y') ?></abbr></div>
           </li>
        		<?php endwhile; ?>
    
        <div id="date">
          <h3>Months</h3>
    
    <ul>
            <?php wp_get_archives('type=monthly&show_post_count=1'); ?>
          </ul>
    <!--
        <h3>Categories</h3>
           <ul class="categories">
           <?php wp_list_categories('title_li=&show_count=1'); ?>
    
     -->
    
        </div>
    
        <div id="cattags">
    
          <h3>Categories</h3>
          <ul class="categories">
          <?php wp_list_categories('title_li=&show_count=1'); ?>
    
        </div>
    
      </div>
    
    </div>
    
    <?php get_footer(); ?>
    Moderator Michael

    @alchymyth

    the general code to use is

    – either:
    the_category() http://codex.wordpress.org/Function_Reference/the_category
    example:

    <div class="post-cat"><?php the_category(', '); ?></div>

    – or:
    get_the_category() http://codex.wordpress.org/Function_Reference/get_the_category
    example:

    <div class="post-cat"><?php $post_cats = get_the_category(); ?><a href="<?php echo get_category_link($post_cats[0]->term_id); ?>"><?php echo $post_cats[0]->name; ?></a></div>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show post category next to post date on Archive page.’ is closed to new replies.