• Resolved smayman

    (@smayman)


    I am using the following code to display excerpts on my front page. I would like to only display excerpts from category 6, yet my page (www.onebigbang.org/DEV) is displaying all posts.

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

    <?php if (in_category('6')); ?>

    <p class="subtitle"><?php the_title(); ?><p>

    <?php the_excerpt_reloaded(120, '<a><img>', 'filter_type', TRUE, 'Read More', FALSE, 2, TRUE); ?>

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

    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    Also, using this code, how can I define how many excerpts I want to display?

    Thanks in advance for answers to what I suspect are dumb questions…

Viewing 6 replies - 1 through 6 (of 6 total)
  • Your issue is NOT related to that plugin.
    Remove that if in_category bit.

    What you want: to exclude the rest of categories from showing up on your index/main/home page.

    Go Extend on the top of this page > Plugins > and search fro category excluder.

    Thread Starter smayman

    (@smayman)

    If you ask me – yes, it would.

    Thread Starter smayman

    (@smayman)

    Cool – thanks. I’m not sure where to put the code in the loop. Right now I am using the following code and it is only showing posts from category 6 – perfect. However it is showing my one post twice. Is my code wrong, or do I just need more posts?

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

    <?php
    if (is_home()) {
    query_posts("cat=6");
    }
    ?>
    <p class="subtitle"><?php the_title(); ?><p>

    <?php the_excerpt_reloaded(70, '<a><img>', 'filter_type', TRUE, 'Read More', FALSE, 2, TRUE); ?>

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

    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    query_posts() *must* occur before The Loop initiates, otherwise it cannot act upon it:

    <?php
    if (is_home()) {
    query_posts("cat=6");
    }
    ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    etc…

    Thread Starter smayman

    (@smayman)

    Thank you so much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Restrict the_excerpt_reloaded by category’ is closed to new replies.