• Resolved papa4174

    (@papa4174)


    I am having the hardest time with my categories. All I want are two seperate categories. One would be called “By Category” and the second would be called “New Sweeps”

    Everytime I make a new post about a new sweepstake and I choose the “New Sweeps” category to put it in it still puts it in both categories.
    Please help me out here, it’s driving me nuts!

    Here is my website:
    https://prizepapa.com

Viewing 4 replies - 1 through 4 (of 4 total)
  • Let’s get back to the basics.
    There are no “sidebar categories”. Posts do have categories (and links, but that’s irrelevant for this case).

    You do NOT have two categories created in your admin panel. What is in your sidebar – doesn’t matter, it’s a mistake of the theme coder: it displays twice the same one category of yours.

    Did you cretae that other category you were talking about?
    No, you didn’t: https://prizepapa.com/category/by-category

    It looks like you are trying to do a list by Category, and then a list of posts for the Category New Sweeps……both are category listings…….

    Because you have only one category (New Sweeps) it just looks like you are showing a duplication. Remember a category will only show if there are posts in it.

    Also I think what you want to do is list posts under New Sweeps, not the category itself, which means you need a different wp_get_archives function….

    So first view the Codex page for wp_get_archives (look at the post_by_post parameter example that says Last Fifteen as a guideline) I think that’s what you want

    Then if you make a few other categories and put some posts in it you’ll see your “By Category” expand as well…..

    get_archives doesn’t have a ‘category’ parameter – so that will never work.
    Everybody falls in this trap: trying to use get_archives AND sort posts by category. No, it does NOT work.

    Ooops you are right Moshu …….. I forgot that I am using a special query to limit my post listings to just one category on a particular theme…

    It looks like this (example):

    <?php
     $previous_posts = get_posts('category=16&numberposts=10');
     foreach($previous_posts as $post) :
     setup_postdata($post);
     ?>
    <li><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>

    My bad……hope this helps in some way…..

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Help with my sidebar Categories’ is closed to new replies.