I want to print (display) the child category slug, so I can use it in a dynamic url, on categories pages. So If I am on the category www.example.com/category/main-category/child-category Example: www.example.com/category/games/board-games
In the sidebar I will have a link Updates from Board Games so I need the code to simply display child-category slug, in this case is "board-games", and child category name, in this case is "Board Games"
on post pages it's simple, I have this code and it's working (maybe someone will find it useful)
<?php $cat_slug = get_the_category(); ?><a href="<?php echo get_bloginfo('url') . "/updates-from-" . $cat_slug->category_nicename; ?>" > Updates from '<?php echo $cat_slug->cat_name . "";?>'</a>
thank you for your help!