• I am using Manifest, a super simple WordPress theme, on my site: http://nick.thejuvenilia.net

    On the main page, which is an Archive page, under the “Works” section, you can see a list of the most recent posts: Tom Brady, Derrick Rose, Cal Ripken Jr.

    Next to the date of each post: January 29th, 2013, January 10th, 2013, December 29th, 2013, I would like the category of each post (the sport I’m talking about) to appear next to the date. E.g.:

    Tom Brady………….January 29th, 2013 / Football
    Derrick Rose………….January 10th, 2013 / Basketball
    Cal Ripken, Jr…………..December 10th, 2012 / Baseball

    Each post on this site will only have one category at any given time. Any suggestions would be helpful. I’ve found the place on the archives.php file where I think I need to insert the code, but am not sure what the code is.

    I can attach said archives.php to this if necessary. Thanks, everyone.

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..

    Thread Starter dylanwaslike

    (@dylanwaslike)

    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(); ?>

    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.