How ist it possible to display the categories in the sidebar ( cat. block ) like this:

cat1, cat2, cat3 cat4, cat5, cat6

and NOT

cat1 cat2 cat3 cat4 cat5 cat6

Can you help ?

THANKS in adv.

best wishes

  • Can we see your code that generates the output you don't want? Oct 17, 2023 at 20:21

1 Answer 1


In WordPress, you can achieve the desired format of displaying categories in the sidebar as "cat1, cat2, cat3 cat4, cat5, cat6" by creating a custom widget or by modifying the default Category widget with a little bit of CSS.

Here's how you can do it:

Custom Widget

Create a Custom HTML Widget: In your WordPress dashboard, go to Appearance > Widgets. Add a "Custom HTML" widget to your sidebar. In the widget content, use HTML to format your categories as needed.

For example:


<span class="category">cat1,</span>

<span class="category">cat2,</span>

<span class="category">cat3</span>

<span class="category">cat4,</span>

<span class="category">cat5,</span>

<span class="category">cat6</span>

Add CSS for Styling: To style your custom category list, you can add CSS to your theme. You can do this in the theme's customizer or by adding CSS to your theme's style.css file. For example:


.category-list {

display: flex;

flex-wrap: wrap;


.category {

margin-right: 5px; /* Adjust the margin as needed to control the spacing between categories */


If you want to get more inspiration and ideas you can visit Apkozone to look for something interesting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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