• ivansuchy

    (@ivansuchy)


    Hello, guys / girls?

    I’m hidding some articles from view in LOOP via following code:


    <?php if (have_posts()): ?>
    <?php while (have_posts()) : the_post(); ?>
    <? if(!in_category(500)): ?> //show article


    but post_nav_link() function counts all posts so there is a problem, when I have 11 posts in database and 10 per page setting, I see link to “older articles” but 11th article is not visible of course so page no. 2 is empty.

Viewing 2 replies - 1 through 2 (of 2 total)
  • viper007bond

    (@viper007bond)

    Use query_posts().

    Just use it right above the <?php if (have_posts()): ?>.

    Thread Starter ivansuchy

    (@ivansuchy)

    Thanks Viper, but solution looks like the following:

    <?php $wp_query->set( 'cat', '-500' ); ?>
    <?php query_posts( '' ); ?>

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

The topic ‘posts_nav_link and excluded articles’ is closed to new replies.