Community Forums › Forums › Archived Forums › Design Tips and Tricks › Excerpts on Category Archive pages only
- This topic has 6 replies, 2 voices, and was last updated 8 years, 11 months ago by
Christoph.
-
AuthorPosts
-
April 3, 2016 at 8:16 pm #182841
beautyfool
MemberHi there!
I am looking for what I wrote in the title above - for my blog to be "normal" on all pages, except in the Category Archives pages, if they can be excerpts.
I tried checking it in the Genesis Theme Settings, but when I click "show excerpts", it also shows it on the homepage.
I'm using the Wintersong Pro theme, you can find my site at http://www.blogforbeauty.com.
Any ideas on how I can show excerpts on Category Archive pages?
Thank you!
April 4, 2016 at 9:31 am #182891Christoph
MemberHi,
you can add code like this to your functions.php.
It will show the excerpt on all category archive pages.add_action( 'genesis_before', 'show_excerpt_on_category_archive_pages' ); function show_excerpt_on_category_archive_pages() { if( is_category() ) { remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); remove_action( 'genesis_entry_content', 'genesis_do_post_image' ); add_action( 'genesis_entry_content', 'the_excerpt' ); } }
For reference: http://www.shilling.id.au/2012/10/22/genesis-framework-how-to-show-experts-or-full-content-on-archive-pages/
April 4, 2016 at 9:32 am #182892Christoph
MemberHi,
you can add code like this to your functions.php.
It will show the excerpt on all category archive pages.add_action( 'genesis_before', 'show_excerpt_on_category_archive_pages' ); function show_excerpt_on_category_archive_pages() { if( is_category() ) { remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); remove_action( 'genesis_entry_content', 'genesis_do_post_image' ); add_action( 'genesis_entry_content', 'the_excerpt' ); } }
For reference:
http://www.shilling.id.au/2012/10/22/genesis-framework-how-to-show-experts-or-full-content-on-archive-pages/
April 6, 2016 at 4:31 am #183031beautyfool
MemberThanks so much Christoph, it worked perfectly!
Last question - would you know how to add the featured image (in a thumbnail) to the excerpts as well?
Thanks!
ReneeApril 6, 2016 at 5:06 pm #183079Christoph
MemberHi Renee,
you can try this:
add_action( 'genesis_before', 'show_excerpt_on_category_archive_pages' ); function show_excerpt_on_category_archive_pages() { if( is_category() ) { remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); remove_action( 'genesis_entry_content', 'genesis_do_post_image' ); add_action( 'genesis_entry_content', 'show_thumbnail_on_category_archive_pages' ); add_action( 'genesis_entry_content', 'the_excerpt' ); } } function show_thumbnail_on_category_archive_pages() { the_post_thumbnail('thumbnail'); }
('thumbnail') sets the size of the image.
April 6, 2016 at 9:05 pm #183090beautyfool
MemberHi Christoph, Thank you, that worked! OK, so I actually now have 2 questions to do with styling (sorry!)
For the size of the thumbnails, in that 'thumbnail' bit you said, what do I write in the code above? My knowledge of coding is very limited so I'm not sure how I should write it. I'm looking for maybe a 270px x 205 thumbnail size, and how may I align it left?
Thank you so much for your help!
April 10, 2016 at 4:28 pm #183312Christoph
MemberHi,
The default image sizes of WordPress are “thumbnail”, “medium”, “large” and “full” (the size of the image you uploaded). These image sizes can be configured in the WordPress Administration Media panel under Settings > Media.
https://developer.wordpress.org/reference/functions/the_post_thumbnail/#comment-280
You should be able to set the alignment when you set the featured image in the post.
If it is not feasible to go back and change the alignment of all featured images, you can change the css.
This is a screenshot of the changes to align the featured image left:
http://screencast.com/t/jl794cvVy
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.