I would use get_categories with the same basic parameters – that will give an array of the categories that you can then build your own list using ul and li – and allow you to change the style on the choice you want.
Thanks for your answer myinstinct, with this menu, I need to list sub categories under a specific category, that explains the “child_of=’.$cat4” which has to be dynamic.
Can I do this with get_categories?
All right, seams to be a possible solution, I do not know the function very well, can you give me an example or a link that explains how to rebuild a menu after using this function?
Thanks myinstinct, I tried to manipulate a bit the drop-down menu as shown on the page you gave me but I am not sure it will help me. Still, my drop-down box appears, with the right subcategory names for the different options.
I guess at least the start may be:
$categories= get_categories('orderby=name&use_desc_for_title=1&depth=1&hierarchical=1&style=0&hide_empty=0&child_of='.$cat4);
foreach ($categories as $cat_z) {...
I now have to create a simple horizontal menu using ul an li, can you help me a bit more?
I haven’t tested this, but it should look something like
echo '<ul>';
foreach ($categories as $cat) {
$option = '<li>' . $cat->category_nicename . '</li>';
echo $option;
}
echo '</ul>';
You may want to make the $cat->category_nicename
a link as well, so
$option = '<li><a href="page to link to here">' . $cat->category_nicename . '</a></li>
';
cool!
Thanks a lot myinstinct.
works fine!
Here we go:
$categories= get_categories('orderby=name&use_desc_for_title=1&depth=1&hierarchical=1&style=0&hide_empty=0&child_of='.$cat4);
echo '<ul>';
foreach ($categories as $catz) {
$option = '<li><a href="./?cat=' . $catz->cat_ID . '">' . $catz->cat_name . '</a></li>';
echo $option;
}
echo '</ul>';
Here is my 95% final code:
<div id="navmenu2">
<?php
//wp_list_categories('orderby=name&use_desc_for_title=1&depth=1&hierarchical=1&style=0&hide_empty=0&child_of='.$cat4);
$categories= get_categories('orderby=name&use_desc_for_title=1&depth=1&hierarchical=1&style=0&hide_empty=0&child_of='.$cat4);
echo '<ul>';
foreach ($categories as $catz) {
$option = '<li><a href="./?cat=' . $catz->cat_ID . '">' . $catz->cat_name . '</a></li>';
$option2 = '<li id="tralala"><a href="./?cat=' . $catz->cat_ID . '">' . $catz->cat_name . '</a></li>';
$cat_numb= $catz->cat_ID;
//echo $cat_numb;
if ( $cat_numb==$catid)
{
echo $option2;
}
else
{
echo $option;
}
}
echo '</ul>';?>
</div>
My only remaining problem is that separation between each line is now more important than when I did not use
I managed to finish this with my css, the main code is up there.
Again, thank you myinstinct, I close the post.