• Anonymous User 96400

    (@anonymized-96400)


    hey,

    i’ve set up wordpress so that my categories are almost seperate blogs. i’ve got a photoblog category, some other categories, all being displayed in a sideblog and my main category ‘travelogues’.

    to make this work i have excluded all categories, except travelogues, from index.php.

    i don’t have that many posts yet, but i recently installed the pagenavi plugin and to try this i set the ‘show at most___posts’ down to 5. the problem then was that there were only 2 posts shown.

    apparently, when i exclude all those other categories from index.php, their posts still count towards whatever you decided your maximum amount of posts would be.

    is there any way to fix this?

    thanks a lot, guys.
    b

Viewing 6 replies - 1 through 6 (of 6 total)
  • b,

    I’m not too sure I understood your question properly.

    Do you want to show 5 posts when only 2 posts of that category are available? Or do you only want to show posts from a specific category on your main page even if they are less than 5?

    How are you excluding the categories from the index?

    Are you using something like Category Visibility plugin or manually coding it?

    Thread Starter Anonymous User 96400

    (@anonymized-96400)

    darwishian,
    Do you want to show 5 posts when only 2 posts of that category are available?
    well, this would be impossible, don’t you think? my problem has nothing to do with 5 or 2 posts. i was merely writing how i found out about the problem.
    i exclude all but one category from the frontpage, but somehow posts from the excluded categories are still counted towards the maximum amount of posts i set under options->reading. now this messes up the index, cause instead of, say 15 posts only 5 are shown. hope this clears things up ??

    handysolo,
    i manually coded this into the index loop:
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php if (in_category('2') || in_category('3')) continue; ?>
    <div class="postmain" id="post-<?php the_ID(); ?>">
    <!--then the loop continues-->

    thanks, b

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Yes, if you use that code, then you will shorten the loop.

    Basically, you’re getting 10 posts. Then, you’re only displaying the posts of certain categories. It doesn’t have any way to know to go back and get more posts because you didn’t display some of them.

    A plugin like the Category Visibility one above operates in a different way. Instead of getting 10 posts from all possible ones, it changes the query to get 10 posts from categories you’re not excluding. That would be the way to go if you want to exclude categories from displaying in certain places.

    Thread Starter Anonymous User 96400

    (@anonymized-96400)

    otto42,
    thanks for this tip. found a plugin that works perfectly.
    now this brings up another problem (doesn’t it always? :). i’m using this code to produce a sideblog on the frontpage:
    <?php rewind_posts(); ?>
    <?php $notDone=true?>
    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    <?php if (in_category(4) && $notDone || in_category(5) && $notDone) { ?>
    <?php echo $post->post_excerpt ?>
    <!-- title, date, content, etc -->
    <?php $notDone=false ?>
    <?php } ?>
    <?php endforeach; ?>
    <?php endif; ?>

    now there is no sideblog, cause the cat-visibility plugin says there’s only the 1 cat allowed on the frontpage. a sideblog plugin won’t do though, cause with the ones available you can only post to 1 category, whereas i have 6 sideblog categories. do you have any solution for this too?
    b

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Use get_posts for this secondary loop instead of rewind_posts.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘maximum amount of posts on index.php’ is closed to new replies.