WordPress.org

Forums

separate categories (8 posts)

  1. correodefelipe
    Member
    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
    in_category('3')

    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
    Member
    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:
    http://www.coffee2code.com/archives/2004/08/27/plugin-customizable-post-listings/

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

  3. correodefelipe
    Member
    Posted 9 years ago #

    I suppose the example that you're telling that's in the LOOP section is:
    http://codex.wordpress.org/The_Loop#Exclude_Posts_From_Some_Category

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

  4. petit
    Member
    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
    Member
    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
    Member
    Posted 9 years ago #

  7. MichaelH
    Member
    Posted 9 years ago #

    correodefelip;

    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(); ?>
    </div>

    <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; ?>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

  8. iand
    Member
    Posted 9 years ago #

    If you are after:
    category 1
    *post
    *post
    category 2
    *post
    *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

Tags

No tags yet.