How to make excerpts only on category pages (4 posts)

  1. debycoles
    Posted 3 years ago #

    Hi, I'm a newbie and I've been reading everything I can on the forums, and often not yet understanding most of it - but learning fast.

    So today, I want to change my category template. I want my single posts and my front page to show the full post, but on the category pages I want the posts to be shortened and just show the featured image, the title and the excerpt.

    I've read that I need to go to my category.php and replace the_content with the_excerpt. Seems perfectly sensible - except when I go to the category.php file it doesn't look like I expect. Here it is:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. Also please use pastebin.com for more than 10 lines of code. ]

    Can anyone tell me what I need to change to get my category pages looking how I like. Perhaps I need to go to a different file - but its all to new to me.

    I very much appreciate any help on this one, as all my searching hasn't been able to find what to do. Thank you.

  2. carbis
    Posted 3 years ago #

    The default post formatting from the post.php template file will be used.

    If you want to customize the post formatting for your category pages:
    - Create a new file: post-category.php
    - Copy/Paste the content of post.php to post-category.php
    - Edit and customize the post-category.php file for your needs.

    Learn more about the get_template_part() function:

  3. debycoles
    Posted 3 years ago #

    Damn it, I can't believe how daft I've been. I spent HOURS today looking this up and it was right there - I just needed you to hit me over the head with it!

    I set up a new file post-category.php. Pasted the content of post.php and changed the content to the excerpt and there it was.
    I am just so embarrassed!

    But thanks for showing me how easy it can be when you read the damned instructions!

  4. carbis
    Posted 3 years ago #

    :) No problem. Glad I could (sort of) help.

Topic Closed

This topic has been closed to new replies.

About this Topic