Printing Child Category Names
-
Ok, so this is a question I don’t know is a possible to answer. I’ve tried googling the solution and not having much luck.
What I do now
For each location on our website, we make a category with the name of the town, in our example below, it’s in “Hot Srings.”Right now we have set up a hierarchy of categories as follows City>Western Arkansas> Hot Springs. So when ever we check the category, this is what appears: City/Town: ? Hot Springs
Because of the code<?php if ( in_category( 'Hot Springs' )) { ?>• <a href="https://abandonedar.com/city/western-arkansas/hot-springs/">Hot Springs</a> <?php } ?>
The goal
We have to go into the back end to add every new city and it gets a little annoying. Is there a way with php to say:<?php if ( in_child_category( 'Western Arkansas' )) { ?>• <a href="https://abandonedar.com/city/western-arkansas/"><?php echo get_cat_name(); ?></a> <?php } ?>
And it would print the category name?
The idea is that this code would streamline the process where we just add the category on the post and it adds prints the name to the frontend, no coding.Is this possible or am I reaching for the stars here?
Thanks in advance!
The page I need help with: [log in to see the link]
- The topic ‘Printing Child Category Names’ is closed to new replies.