• Hi Guys,

    I do hope you are well, I have a problem I am hoping someone can resolve:

    I have a blog I am working on which shows the articles from that category in the right navigation e.g.

    https://www.home-weightloss.com/category/weight-loss/tips/

    However for some reason the code is showing them all twice, strangly it works here: https://www.home-weightloss.com/category/reviews/products/ but all the other categories are duplicated.

    The code I am using is:

    <?php global $post;
    $categories = get_the_category();
    foreach ($categories as $category) :
    ?>
    <ul>
    <?php
    $posts = get_posts('numberposts=20&amp;category='. $category->term_id);
    foreach($posts as $post) :
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    <?php endforeach; ?>
    </ul>

    Thanks for your time.

    Andy

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Duplicate articles in navigation’ is closed to new replies.