retrieving cat ID via cat slug
I’m crafting a theme for public release.
I’d like to list, in the main menu, up to 7 categories, that the user would choose between those he has already prepared by his own, assigning from the Admin Panel some new slugs to his already set up cats.
The problem is, that
wp_list_categoriesis asking me for some numeric IDs, which me, as a themer, I ingore because they will depend on every single WP install, so I can’t use such an idea.
Do you know if it’s possible to code some PHP, turning a slug (known, coded in the template, communicated to the user in the instructions) into a numeric ID (unknown, used to print a link) ?
This, simpler in its focus, was giving me the printed word ‘Array’. 🙂
<?php $category = get_the_category('category_nicename=cat1'); echo $category ; ?>
Thanks for any input.
- The topic ‘retrieving cat ID via cat slug’ is closed to new replies.