Removing excerpts and images from category pages
-
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
You can do this using a child theme.
Try placing this code into your child theme’s
functions.phpfile:function naoft_excerpt_filter( $excerpt ){
if ( is_category() ) return '';
else return $excerpt;
}
add_filter( 'the_excerpt', 'naoft_excerpt_filter' );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
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.
Unfortunately they’re the smallest size, which is 150×150.
Admin
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?
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
lol ok. Please provide a link to one of the category’s pages so I can take a look.
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
Add this to your child theme’s
style.cssfile:.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)
- 1
- 2
- You must be logged in to reply to this topic.
