separate categories (8 posts)

  1. correodefelipe
    Posted 9 years ago #

    Hi, I just upgrade to 2.0.1 and I have been trying to separate my different categories posts in different tables.

    I know theres a post for that in THE LOOP section but it seems the function

    is no more useful in wp-2.0.1.

    is that true? how can I separate on my index file my posts by categories then?

  2. MichaelH
    Posted 9 years ago #

    Well I know there's examples in The_Loop but can't get to Codex right now. Also have heard that Coffee2Code has a good plugin for this:

    There's also this "How do I hide a category from the front page index.php?" in FAQ_Layout_and_Design

  3. correodefelipe
    Posted 9 years ago #

    I suppose the example that you're telling that's in the LOOP section is:

    well I have tried it with no success in my wp2.0.1 installation.

  4. petit
    Posted 9 years ago #

    Well, the technique described in The:Loop#Exclude_Posts_ ... that, you point to in your last post, works well for me using WP 2.01.

    You may also want to make your own home.php, which loads first if present and maybe just present you blog ( about ) and other nice stuff and maybe a category listing with a good description for each category.

  5. correodefelipe
    Posted 9 years ago #

    thank you petit for your reply, can post your LOOP code or at least just the part where you exclude the category.

  6. moshu
    Posted 9 years ago #

  7. MichaelH
    Posted 9 years ago #


    In 2.0.1 I used the exact code from The_Loop as suggested above and it worked--meaning it excluded any posts in Category 3 from displaying.

    Here's my index.php file I used under themes/default.

    <?php get_header(); ?>

    <div id="content" class="narrowcolumn">

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <!-- The following tests if the current post is in category 3. -->
    <!-- If it is not, the code within The Loop is executed as normal. -->
    <!-- If it is, nothing is done until the next post is processed. -->
    <?php if ( !(in_category('3')) ) { ?>

    <div class="post">

    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

    <small><?php the_time('F jS, Y'); ?></small>

    <div class="entry">
    <?php the_content(); ?>

    <p class="postmetadata">Posted in <?php the_category(', '); ?>

    </div> <!-- closes the first div box -->

    <?php } ?> <!-- Close the if statement. -->

    <?php endwhile; else: ?>
    Sorry, no posts matched your criteria.

    <?php endif; ?>


    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

  8. iand
    Posted 9 years ago #

    If you are after:
    category 1
    category 2
    *post etc..

    Try this thread. You can see an example of it here (select 'ajaxed' from the theme list).

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.