Removing excerpts and images from category pages

  • Anonymous

    #4844

    Hi all,

    I have hundreds of category pages on my site. I use them to bring in some additional traffic, not for on-site navigational purposes.

    Unfortunately, because they are (and need to be) indexed, I get the excerpts of posts within each category appearing in Copyscape as duplicate content, something I would rather avoid even if the SEO impact is minimal.

    What I want to do is strip all excerpts (and images, since it would look weird otherwise) from category pages, leaving only the titles of the posts that fall into the category visible.

    Any ideas? Thanks in advance!

    Admin

    Syahir Hakim

    #29469

    You can do this using a child theme.

    Try placing this code into your child theme’s functions.php file:

    function naoft_excerpt_filter( $excerpt ){
    if ( is_category() ) return '';
    else return $excerpt;
    }
    add_filter( 'the_excerpt', 'naoft_excerpt_filter' );

    Anonymous

    #29470

    Thanks Syahir!

    That removed the excerpt, which is the most important part, but the images remain.

    Perhaps there is a way to remove them, or, if that’s difficult, centralise them so that the arrangement looks more presentable? In fact, the latter might be preferred.

    Thanks!

    Admin

    Syahir Hakim

    #29471

    How big are the pictures that you use as the thumbnail? If they’re big enough, you can do some changes so that the pictures extend the entire width of the content area in the category page.

    Anonymous

    #29472

    Unfortunately they’re the smallest size, which is 150×150.

    Admin

    Syahir Hakim

    #29473

    Yes, by default the theme shows the thumbnail size on the category page. But what’s the original size of the images that you uploaded?

    Anonymous

    #29474

    Sorry, I should have made it clear: The actual size before uploading is also 150×150. I resize my images to 150×150 before uploading them to WordPress so that there is only one copy of the image in the uploads folder.

    But to be honest, I’m not sure if I would want them extending the width of the container anyway. :3

    Admin

    Syahir Hakim

    #29475

    lol ok. Please provide a link to one of the category’s pages so I can take a look.

    Anonymous

    #29476

    Sure thing, I’ve temporarily changed my username URL to an example of a category page for you to see. Better than an ugly raw link posted here :p

    Admin

    Syahir Hakim

    #29477

    Add this to your child theme’s style.css file:

    .archive .entry-content .excerpt-thumb {
    text-align: center;
    }
    .archive .entry-content .excerpt-thumb img {
    float: none;
    margin: 0;
    }
Viewing 10 posts - 1 through 10 (of 11 total)

You must be logged in to reply to this topic.

Do NOT follow this link or you will be banned from the site!