ThemeShaper Forums » Thematic

Can I target .hentry for only category archive pages?

(5 posts)
  • Started 13 years ago by awarner20
  • Latest reply from amygail
  • This topic is not resolved
  1. Sorry if this is a simpleton question. I am using category archive template pages. I am trying to put the posts in a grid on these category pages. I have edited the .hentry and am successful, but it also affects the posts layout on the regular posts page (and regular page templates).

    Is there a way to target the .hentry on category pages only?

    Posted 13 years ago #
  2. Well, I accomplished my goal. I should have added above that I am also hooking into the category loop on these category page templates using the functions.php. So, here was how I solved my issue.

    My functions.php contains this:

    function remove_categoryloop() {
        remove_action('thematic_categoryloop', 'thematic_category_loop');
    add_action('init', 'remove_categoryloop');
    function my_categoryloop() {
    while (have_posts()) : the_post(); ?>
            <div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class(); ?>">
                  <?php thematic_postheader(); ?>
                  <div class="entry-content">
    <?php thematic_content(); ?>
                  <?php thematic_postfooter(); ?>
              </div><!-- .post -->
          <?php endwhile;
    add_action('thematic_categoryloop', 'my_categoryloop');

    So, I just changed the post class from this:

    <div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class(); ?>"> this...

    <div id="post-<?php the_ID(); ?>" class="cat-page-posts">

    ...and then added:
    } my child theme stylesheet.

    Posted 13 years ago #
  3. amygail

    Glad you worked it out.

    You know that Thematic already generates dynamic classes for you, right?
    For instance, I use:

    body.category-gigs .hentry {}
    To style the archives page for the gigs category

    body.s-category-gigs .hentry {

    To style the individual posts in that cateory

    Posted 13 years ago #
  4. Hey amygail,

    Thanks for the tip, I wasn't aware of that, I'll keep that in mind if I need to change one or two category archive pages. I'm going to stick with my method above for now though because I need to style 85 category archive pages. Fortunately, they will all be styled the same:)

    Posted 13 years ago #
  5. amygail

    Hey, whatever works!

    You don't have to specify the category, you can style them all like this

    body.category .hentry {}
    To style the archives page for the gigs category

    body.s-category .hentry {


    Posted 13 years ago #

RSS feed for this topic


You must log in to post.