So far I've made 2 categories for my website in WordPress and yet I just have 1 in the sidebar. What should I do to show all the categories in the sidebar? I've made a post for each category.


When I entered page with House Category

  • Are both posts published, publicly viewable, and dated/timed earlier than the current date/time? If they're private, drafts, or set to a future date, they won't show up. If not, I'd suggest adding your sidebar code so we can take a closer look. Are you using the default category widget? – WebElaine May 1 '17 at 18:19
  • okay, this is my sidebar code.. thanks for helping me :) <div id="sb"> <form action="<?php bloginfo('siteurl'); ?>" id="searchform" method="get"> <input type="search" class="insearch" id="s" name="s" placeholder="Search here.." required /> <div class="cl"></div> </form> <div class="ps"> <h3 class="hc">Popular post :</h3> <div class="po"> <?php include (TEMPLATEPATH . '/popular.php'); ?> </div> <h3 class="hc">Category :</h3> <div class="ct"> <ul> <li><?php the_category(', ') ?></li> </ul> </div> </div> </div> – Ananda Vj May 1 '17 at 20:31
  • and also, this is my wordpress's posts... I can't post it here because i don't have 10 or higher rep yet.. >>>> imgur.com/a/3ZdxR <<<< – Ananda Vj May 1 '17 at 20:38
  • I think so, they are viewable, and also it;s the current date/time.. also publised.. I'm confused that when I go to the post with house category, the sidebar category changed to house "Only", no apartment category there.. then when i go to home site or to the apartment category I just see apartment category there, no house category :( – Ananda Vj May 1 '17 at 20:41
  • 1

As noted in the comments the issue here is that the sidebar was calling the_category(), which displays only the current category, rather than listing all categories.

An even more "WP way" approach is to make the sidebar dynamic. That way, you can use widgets rather than hard-coding what appears in the sidebar. WP has a number of built-in widgets, including a category list, so you don't have to code it yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.