Secure77

Techblog and Security

Activello Theme – show all categories

Sheets

Activello Theme – show all categories

The Activello theme is a simple, clean and free WordPress theme from colorlib.

As WordPress usual, you can add one or more categories to your posts.

On the start page, the Activello default theme, only displays one of the linked categories from your post.

All other categories will be added as a context menu and shows up when you mouse over the three dots.

If you want to display all categories, you can get this by a change in the content.php and some additional css customization.


content.php

You can find the content.php in the folder template-parts of the theme folder. As the content.php is a part of the theme, it is recommended to create a child theme. You can create your own or use mine from here:

For a quick win, you can simple edit the content.php with the integrated theme editor from WordPress.

What we need, is to replace this line:

with this:

<div class="cat-title-grid">
<?php  echo get_the_category_list(); ?>
</div

by simple replacing the function with the get_the_category_list(); function, which is already used to show the categories when you click on a single post, all categories will also be displayed in the header of the post preview. To control the style we also add the custom css class cat-title-grid. Here you can find the final content.php


Add custom css

Finally we need to add some css to display the categories in one line

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert