• Resolved kgetchell

    (@kgetchell)


    I am not very versed in php, I can read it and modify it, but cannot create. I am curious how to create “the loop” (on main blog page) so it will display the post as normal, but on one category I want to display ONLY the excerpt. Any help is appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter kgetchell

    (@kgetchell)

    Thanks Shane, custom pages/post/category/archive template pages are not what I am looking for though.

    What I am trying to do is on the main page of the blog only. Typically a blog will list your posts via date sequence not paying attention to the category. I would like to create a loop so that it still functions as it normally should (display posts in sequential format), however query the category at the same time and if it is a particular category display the excerpt only. All other posts would be displayed as normal full posts except said category.

    I hope this is a bit more descriptive. I find it a bit difficult to explain when I have a vague idea of what’s going on 😛

    Thread Starter kgetchell

    (@kgetchell)

    I think found something that is similar to what I want to accomplish, only this one is display based upon count of posts.. I guess I could change the post_count to category or something similar.

    <?php if (have_posts()) : ?>

    <?php if (($wp_query->post_count) > 1) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <!– Do your post header stuff here for excerpts–>
    <?php the_excerpt() ?>
    <!– Do your post footer stuff here for excerpts–>
    <?php endwhile; ?>

    <?php else : ?>

    <?php while (have_posts()) : the_post(); ?>
    <!– Do your post header stuff here for single post–>
    <?php the_content() ?>
    <!– Do your post footer stuff here for single post–>
    <?php endwhile; ?>

    <?php endif; ?>

    <?php else : ?>
    <!– Stuff to do if there are no posts–>

    <?php endif; ?>

    The Loop article has an example of styling a post differently based on category which is pretty much what you are trying to do:

    Thread Starter kgetchell

    (@kgetchell)

    Thanks Michael, that’s an even better example than I had found!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Custom Post’ is closed to new replies.