I used the following code to give out the category name (without link) in a single post.
How would it be possible for the category name that is given out to only appears in small letters ?
I just think this has to be made with substring, but I dont get it 🙂
Could somebody please help me 🙂
<?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?>
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
I would personally achieve this by using strtolower which changes the case of the string.
<?php
$categories = get_the_category();
foreach($categories as $category)
{
echo strtolower($category->cat_name) . ' ';
}
?>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0