ThemeShaper Forums » Thematic


Add category title to post header

(2 posts)
  • Started 9 years ago by jimc
  • Latest reply from tarpontech
  • This topic is not resolved
  1. jimc

    Hi all,

    How do i get the category for a post added to the loop?

    Add category to <?php thematic_postheader(); ?>

    Currently by default the themematic theme shows the author and date..

    Thanks for your help!

    Jim C.

    Posted 9 years ago #
  2. You need to create a filter on thematic_postheader. You'll want to peek inside of /thematic/library/extensions/content_extensions.php. Well...more than peek.

    anyhow...this isn't exactly what we want, but maybe it'll get you headed in the right direction...This filter removes the author, and adds the category name...but it doesn't make the category name a link...i ran out of time figuring it out...once you figure out how to mangle the get_category portion to display as a're probably close to what you want.

    // custom post header
    function childtheme_postheader() {
        global $post; 
        if (is_page() || is_404() || is_single()) {
        } else { ?>
    		<h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'thematic'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h2>
    		<?php if ($post->post_type == 'post') { ?>
    		<div class="entry-meta">
    			<span class="entry-date"><abbr class="published" title="<?php get_the_time('Y-m-d\TH:i:sO'); ?>"><?php the_time('F jS, Y') ?></abbr></span>
    			<?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?>
    		</div><!-- .entry-meta -->
    		<?php } ?>
        <?php }
    add_filter ('thematic_postheader', 'childtheme_postheader');
    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.