• Hi,

    I want to use a different comment-bubble image for the excerpts that appear on the category.php page under the first full post. However, I can’t target them as there is no separate class or id to identify the comments-link class in the excerpt. Both full post and excerpts have the same classes in the Twentyeleven content.php.

    <article id="post" etc. >
    <header class="entry-header">
    <div class="comments-link">

    I’ve been able to add the class ‘excerpt’so I can target the actually text of the excerpt. But I want to add a class to < article > when it’s an excerpt so I can target the comment_link class.

    So something along the lines of
    <article id="post-<?php the_ID(); ?>" <?php post_class(<IF IS_EXCERPT ADD 'excerpt'); ?>>

    The relevant code in content.php in my Twentyeleven child theme is currently as follows:

    [code moderated - please follow the guidelines under http://codex.wordpress.org/Forum_Welcome#Posting_Code when posting code]

    Thanks for your help in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • … for the excerpts that appear on the category.php page under the first full post.

    according to the code, there is no excerpt – just the content up to the ‘more-tag’;

    how are you defining the excerpt?
    can you post a link to your site to illustrate what you are seeing?

    Thread Starter Freelancealot

    (@freelancealot)

    Hi alchymyth,

    Sorry for the delay in getting back to you.

    The site page is at http://bit.ly/pOoerP

    You’ll see to the right of the post title a cartoon figure that replaces the comment bubble.

    If you scroll down to below that first post, you’ll see two previous posts which are just shown up to the <– more –> tag.

    I want to target these two and use a smaller image.

    I’m using TwentyEleven, and making changes in a child theme. The default on Twenty Eleven is to show the whole post on the category page, or up to the <– more –> tag.

    I would prefer to get the category pages showing the lates post in full (as it does now) and then showing two excerpts (which would be easier than having to manually add the <– more –> tag every time.

    I’ve already set up a category-38.php to show the posts, so I’m happy to hack the template I’ve made in the Child theme.

    Any idea how to do the either of these?

    Thanks for any pointers you can give.

    Cheers,
    Tracy

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Need to add class to article tag when it's a excerpt in TwentyEleven content.php’ is closed to new replies.