How to change the layout of posts in a category (wordpress) ?

5 replies
Here's what I mean..

Instead of having the entire posts from a certain category displayed..

Seen here: Muay Thai Training Journal | Fight Passport

I'd rather change it so that the posts from each category are displayed so that it shows a post thumbnail as well as some teaser text..

Example here: MMA Shorts | MMA Gear Reviews

It would just make it easier for readers to navigate.

Anyone know of an easy way to do this?

Thanks in advance,

Bill
#category #change #layout #posts #wordpress
  • Profile picture of the author oneplusone
    I believe there is a way to do it, if one of the WordPress experts is about they can probably help.

    Most of the themes I use do it automatically
    Signature
    'If you hear a voice within you say "you cannot paint," then by all means paint and that voice will be silenced.' Vincent Van Gogh.
    {{ DiscussionBoard.errors[3950495].message }}
  • Profile picture of the author MuayThaiGuy
    Yeah, unfortunately this theme doesn't and I can't get support for it anymore from the theme developer. It seems like it would be basic though.
    {{ DiscussionBoard.errors[3950543].message }}
  • Profile picture of the author MuayThaiGuy
    Anyone?

    There's gotta be a way.
    {{ DiscussionBoard.errors[3951212].message }}
  • Profile picture of the author Blaine Moore
    How comfortable are you editing the theme files?
    {{ DiscussionBoard.errors[3951250].message }}
  • Profile picture of the author Blaine Moore
    Actually clicked through and saw what you were pointing out, and that was much different than what I thought you were trying to do (and much easier!)

    1. Make a copy of the category.php file and rename it as category-#.php where # is the category ID (check the URL when editing the category in wordpress admin in order to find it.) This will create a new file to handle layout of this one category rather than your standard category.php file.

    2. Look for the code inside the loop, which usually starts with something similar to:
    Code:
    <?php while (have_posts()) : the_post(); ?>
    3. Edit the code in there to display your category posts how you want them to be displayed, which is going to depend upon your template and what hooks it has available. I'm not sure exactly what to do to get the thumbnail images, but you can change a call to the_content(); to the_excerpt(); to get your excerpt instead of the normal full post. Check the wordpress codex for parameters you can pass in to help control how it's displayed if you want to fine tune the control, and look at other pages in your theme for how to get the thumbnail out (whether it uses a custom field, or searches the post, or whatever the case might be.) You can usually copy the code directly from another page.

    4. Upload the category-3.php (or whatever you named it as long as it's the correct ID for that category) and when viewing the category page it will now have the new layout while other category pages are still displayed the same as always. If you want all category pages updated, then make a backup of category.php and then make changes to that file instead of a renamed file.
    {{ DiscussionBoard.errors[3951314].message }}

Trending Topics