Forums

post with multiple categories displays multiple times on index.php (2.1.1) (5 posts)

  1. dss
    Member
    Posted 5 years ago #

    Since upgrading to 2.1.1 my index is displaying posts multiple times. Each post with more than one category appears once for each category it is associated with.

    example:
    post title : category A, C, E
    appears three times on the index

    post title: category A
    appears once

    For now, i went into each post and removed the multiple categories, and it's displaying fine, but often I want to post a single entry in more than one category.

    This only seems to be happening on the index, and not in the archives.

    here's my loop:

    <?php if (have_posts()) : while (have_posts()) : the_post();
    $loopcounter++; ?>
    
            <?php if ($loopcounter == 1) { ?>
            <div id=&quot;date&quot;>
            <a href=&quot;<?php the_permalink() ?>&quot; rel=&quot;bookmark&quot; title=&quot;<?php the_title(); ?>&quot;><span class=&quot;head_new&quot;><?php the_title(); ?></span></a> <span class=&quot;talk&quot;><?php comments_popup_link('', '1', '% '); ?></span>
            </div>
            <div id=&quot;tumble&quot; class=&quot;<?php $cat = get_the_category(); $cat = $cat[0]; echo $cat->cat_name; ?>&quot;>
            <?php the_content(__('(read more...)')); ?>
            <p class=&quot;meta&quot;>Posted <?php the_date('l, F jS, Y') ?> in <?php the_category(', ') ?> <?php edit_post_link('Edit', ' | ', ''); ?></p>
            </div>
    
    <?php } else { ?>
            <div class=&quot;date&quot;>
            <a href=&quot;<?php the_permalink() ?>&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link to <?php the_title(); ?>&quot;><?php the_title(); ?></a><span class=&quot;talk&quot;><?php comments_popup_link('', '1', '% '); ?></span>
            </div>
            <? } ?>
    
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>
    

    what am I doing wrong?

  2. Daxeel
    Member
    Posted 5 years ago #

    I had the same problem.
    I resolved it deactivating the Category Exclusion plugin by Mattias Päivärinta.

    Now I use this one:
    http://www.fidgeting.net/wordpress-plugins/ultimate-category-excluder/

  3. dss
    Member
    Posted 5 years ago #

    I wasn't using a cateogry exclusion plugin. If possible, I like to avoid plugins, and use the loop, or string to do what I'd like to do.

    So many unexplained changes in this version.
    I think it was too soon to get so excited and release it.

    Bummin'

  4. Otto
    Tech Ninja
    Posted 5 years ago #

    dss: A lot of people have had this sort of problem. Without exception, it has been due to some plugin they are running. Try deactivating your plugins until the problem goes away. Then look for an update to that plugin.

    2.1 is not completely compatible with 2.0. There will be oddities due to these incompatibilities.

  5. dss
    Member
    Posted 5 years ago #

    Thanks, yeah. I've been trying that. No luck. However, should i locate the culprit, I'll return and let you know which plug (or scrap of code) it was.

Topic Closed

This topic has been closed to new replies.

About this Topic