Support » Fixing WordPress » Loop Cycle

  • Resolved Luigino


    hello everyone!!!

    I have this homemade loop cycle:

    <div id=”content”>
    <?php query_posts(“category__not_in=24”); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php if (in_category(“24”)) continue; ?>
    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <div class=”post-head”>
    <div class=”post-date”><span class=”post-month”><?php the_time(‘M’) ?></span> <span class=”post-day”><?php the_time(‘d’) ?></span></div>
    <div class=”post-blocktitle”>
    <h2 class=”post-title”>” class=”post-title” rel=”bookmark”><?php the_title(); ?></h2>
    <span class=”post-author”>Inserito da: <?php the_author(); ?> in <?php foreach((get_the_category()) as $category) { echo $category->cat_name . ‘ ‘;} ?> il <?php the_time(‘j F Y’) ?></span>
    <div class=”post-contents”>
    <div class=”post-content”><?php the_content(‘Continue…»’); ?></div>
    </div><!–[post contents]–>
    </div><!– [post] –>
    <?php endwhile; ?>
    <div class=”navigation”>
    <span class=”previous-entries”><?php next_posts_link(‘Previous Entries…’) ?></span><span class=”next-entries”><?php previous_posts_link(‘Next Entries…’) ?></span>
    <?php else : ?>
    <p class=”center”>I’m sorry, there are no posts in this page.</p>
    <?php endif; ?>

    where with category 24 there are posts that I use for sticky boxes… here indeed I have no posts in other categories so I should get “I’m sorry, there are no posts in this page.” but I get “Previous entries”…that’s weird to me because that “if (have_posts())” should return false and show the message “I’m sorry…”

    Any suggest?


Viewing 3 replies - 1 through 3 (of 3 total)
  • How about:

       'category__not_in' => array(24),

    Yes now it works!!!
    Even it was weird before because I followed an example from codex about using category_not_in=24… at least now it works with this code sample 🙂

    Thanks MichaelH 🙂

    You’re welcome–if you could point out that Codex example I’ll fix it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Loop Cycle’ is closed to new replies.