Customizing a category

I created a specific category page (category-youth-minisries.php) at
http://fixmysite.us/gmpc/wordpress/?cat=7
and want to know how to make a few customizations,
Instead of the excerpt showing up, how do I display the full post
And after that how do I provide links to the last 10-15 posts?

Thanks…

As you probably know, each page-type (category, post, page, etc) gets a different “theme”. If it’s a sinlge post, then it loads single.php, if its a category then it loads category.php, etc.

Before loading category.php it first checks to see if category-ID.php exists (ID being the id of the category). If it does, then it will build the page using category-ID.php instead of category.php. So, simply drop a file called category-7.php in your templates root and your done. There are other ways, but that’s the most straightforward.

Copy+Paste category.php into category-7.php. Then look for where the excerpt is echoed in and remove it. Then use this function http://codex.wordpress.org/Function_Reference/wp_get_recent_posts .

ok, created the category-7.php page


<?php
/**
 * The template for displaying Category Archive pages.
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header(); ?>
<style>
.arrowlistmenu ul li:last-child {
background-color: #F3F3F3;
}
</style>
        <div id="container">
    <div id="sidebar">
  <img src="wp-content/themes/GMPC/images/youth.png" alt="Youth Ministries" class="top">
<div id="calendar">
<h2>Events Calendar</h2>
<?php
require("../calendar/calendar.php"); 
?>
</div>            
<?php
require("blog_include.html"); 
?>
    </div>
    <div id="content" role="main">
                <?php
                    $category_description = category_description();
                    if ( ! empty( $category_description ) )
                        echo '<div class="archive-meta">' . $category_description . '</div>';

                /* Run the loop for the category page to output the posts.
                 * If you want to overload this in a child theme then include a file
                 * called loop-category.php and that will be used instead.
                 */
                get_template_part( 'loop', 'category' );
                ?>

            </div><!-- #content -->
        </div><!-- #container -->
<?php get_footer(); ?>

and its at
http://fixmysite.us/gmpc/wordpress/?cat=7
/the only thing is… where can I get rid of the excerpt? I gather its in the loop, but wanted to check with you before I start guessing.

You got it! You’ll need to look in loop.php (or create loop-category.php like you just did to keep things separated). Each template is a little different, but you need to find a line in that file that has:

the_excerpt();

Usually on it’s own line. It should be inside an if statement, that looks something like this:

if(something){
   the_content();
} else {
   the_excerpt();
}

You’re going to need to remove the if statement and just have the_content(). If your unsure, just post the loop here and I’ll walk you through it, each theme is slightly different.

ok, thats not too hard.
Now im wondering as the site has loads of pages (http://fixmysite.us/gmpc/wordpress/?page_id=143) and only three non-pages. The three categories (Children Ministries, Pastors Posts, and Youth Ministries) will be the only pages which will even have blogging capabilities.
So if those categories pages the only pages using the loop.php file as I dont even know if the pages use the loop.php file (since they were created using wordpress). Do you know if its safe to edit the loop.php file or should I just creat a loop-category.php file for the categories.

Where did you go to get to know how to do this?

It’s perfectly safe to edit the loop.php, in fact, it’s safe to edit any file within the template directory. I would create a backup though.

Also, I like to create a loop-something.php just because it gives me more control with less code per page. It’s really up to you. Just know that if you DON’T use loop-something.php then any changes AND errors you make inside loop.php will happen to EVERY single page. At least if you use loop-category-7.php etc, if you get an error at least only those pages break.

I’ve been doing it for a while, so I’ve learned most of this over time. In fact I didn’t even know PHP, I learned it while I was learning Wordpress. Wordpress has “The Codex” which has all the docs you need. This page http://codex.wordpress.org/Theme_Development has pretty much anything you need to know about the files inside the Theme directory. It’s quite a bit to read, but if you ever have a few minutes to read through it, you’ll pretty much know everything I know about theming!

what does this do (its in the page.php file


            <?php
            /* Run the loop to output the page.
             * If you want to overload this in a child theme then include a file
             * called loop-page.php and that will be used instead.
             */
            get_template_part( 'loop', 'page' );
            ?>

It starts whats called “The Loop”.

The loop is basically just a while…loop Wordpress uses to iterate through a list of pages/categories/posts/etc. It either looks for “loop-page.php” or “loop.php” if it doesn’t exist…if it looked like:

get_template_part(‘foo’, ‘bar’);

It would look for a file called “foo-bar.php” and if it failed then “foo.php”.

It’s used to either show a blogroll, create a list of categories, etc. In your case, it would probably go through each page and check whether it should show the_content or the_excerpt.