WordPress.org

Ready to get started?Download WordPress

Forums

Posts Repeating twice in categories (2 posts)

  1. catstasmania
    Member
    Posted 7 years ago #

    Hi there.

    This is my first post for help related to WordPress. I'd most most appreciative for any assistance.

    I am having difficulty with category templates and repeating posts.

    I am modifying nautica-magazine theme.

    I have templates, each identical (bar the internal reference in each to call posts by category IDs)

    Ie - Category-3.php includes

    <?php $posts = get_posts( "category=3&numberposts=3" ); ?>

    Everything is working well - except when I view categories that have more than 1 post - wordpress is displaying all posts twice.

    In such categories it displays posts as

    post 1
    post 2
    post 3
    post 1
    post 2
    post 3

    not

    post 1
    post 1
    post 2
    post 2
    post 3
    post 3

    Copied below is an example (taken from category-3.php) of the custome catergory template am using.

    Any advice would be great!

    Cheers

    [moderated: code pasted at http://wordpress.pastebin.ca/547632 ]

  2. MichaelH
    Member
    Posted 7 years ago #

    Don't believe you need that get_posts logic.

    For example, using the WordPress Default 1.6 theme, copy the archive.php file to a file called category-3.php and then click on your Category 3 on the main page and it will display only category 3 posts when it invokes that template.

    Resources:
    Category Templates
    Template Hierarchy

Topic Closed

This topic has been closed to new replies.

About this Topic