Use get_option to retrieve url of category?
-
Hi guys,
I’m trying to get a list of sub-categories to display on a page when the parent category is clicked on.
I managed to get the sub-categories listed, but I can’t get the links on those sub-categories to point to the sub-category URL.
Is there a get_option that will allow me to retrieve the URL/permalink of that sub-category?
Here’s the code I’m using.
`
<?php
$categories = get_categories(‘child_of=1&orderby=ID&hide_empty=0’);
foreach ($categories as $cat) {
if ($cat->category_parent != 0) {
echo ‘<span style=”padding-left:10px;”>’;
}
echo ‘<div class=”title-insert main-post-bg-a showhero”>
<h2>category_nicename.’/”>’.$cat->cat_name.’</h2>
</div> ‘;
echo ‘
‘;
}
?>
`Please advice!
Thanks
- The topic ‘Use get_option to retrieve url of category?’ is closed to new replies.