ThemeShaper Forums » Thematic

[closed]

"Older posts" link displayed when no previous posts to show

(2 posts)
  • Started 13 years ago by madmaia
  • Latest reply from middlesister
  • This topic is not resolved
  1. madmaia
    Member

    Hi, I am using the FrontpageSlideshow plugin to display selected posts on my (static) home page so I need to then exclude this category ('slide-show') from the blog pages.

    I am trying to do this by overriding the index loop:
    //override index loop to exclude slide-show posts
    function childtheme_override_index_loop() {
    global $options, $blog_id;
    foreach ($options as $value) {
    if (get_option( $value['id'] ) === FALSE) {
    $$value['id'] = $value['std'];
    } else {
    if (THEMATIC_MB) {
    $$value['id'] = get_option($blog_id, $value['id'] );
    } else {
    $$value['id'] = get_option( $value['id'] );
    }
    }
    }
    /* Count the number of posts so we can insert a widgetized area */ $count = 1;
    // need to keep track of how many posts I am displaying
    $postLimit = 5; // max number of posts to show
    $postCount = 0;
    while ( (have_posts()) && ($postCount < $postLimit) ) {
    the_post();
    if (!in_category(array('slide-show'))) {
    thematic_abovepost(); ?>
    <div id="post-<?php the_ID();
    echo '" ';
    if (!(THEMATIC_COMPATIBLE_POST_CLASS)) {
    post_class();
    echo '>';
    } else {
    echo 'class="';
    thematic_post_class();
    echo '">';
    }
    thematic_postheader(); ?>
    <div class="entry-content">
    <?php thematic_content(); ?>
    <?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
    </div><!-- .entry-content -->
    <?php thematic_postfooter(); ?>
    </div><!-- #post --><?php
    thematic_belowpost();
    comments_template();
    if ($count==$thm_insert_position) {
    get_sidebar('index-insert');
    }
    $count = $count + 1;
    $postCount = $postCount + 1;
    }
    }
    } // end index_loop

    The problem is that it correctly displays the only four posts currently present, but shows the "older posts" links too - which links to a blank page. So somehow I guess my index loop override is failing to influence the thematic_nav_below() function correctly? If I remove my childtheme_override_index_loop() function the older posts link works fine, but of course all the slide-show posts are shown as well... (See here)

    Any help appreciated, we need to get this site live ASAP - but isn't that always the way?!

    Posted 13 years ago #
  2. middlesister
    Member

    If you just want to exclude posts from a category from the index loop, there is an easier way. Check the thread http://forums.themeshaper.com/topic/exclude-posts-from-specific-categories

    //Exclude posts from category xyz
    function excludeposts() {
       if (is_home()) {
          query_posts("cat=-4136");
       }
       }
    add_filter ('thematic_above_indexloop','excludeposts');

    Where '4136' is the ID of the category you want to exclude.

    Posted 13 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.