Pinegrow Community Support Forum

Setting up Wordpress category dropdown menu

So I’m starting a Wordpress blog theme from scratch using Wordpress blocks. I have a good understanding of the basic WP framework and how Pinegrow adds WP functions to common page elements, but I’m having some trouble wrapping my head around how the category dropdown menu works. I figured there would be a list item loop (like for blog posts) to add for the first drop down item and it would propagate all category items inside the menu but there is no such function. I’m left with a dropdown menu that looks something like this:

<div class="dropdown" wp-dropdown-categories wp-dropdown-categories-orderby="NAME" wp-dropdown-categories-order="DESC"> 
                        <a data-toggle="dropdown" href="#">Dropdown trigger</a> 
                        <ul class="dropdown-menu" role="menu"> 
                            <li>
                                <a href="#">Action</a>
                            </li>                                 
                            <li>
                                <a href="#">Another action</a>
                            </li>                                 
                            <li>
                                <a href="#">Something else here</a>
                            </li>
                            <li class="divider"></li>                                 
                            <li>
                                <a href="#">Separated link</a>
                            </li>
                        </ul>                             
                    </div>

I realize that the function replaces the whole element, but I think I need some clarification as to how the menu will appear and which element I can apply styles to.

@Regi do you know about wp_list_categories and how to show categories in List View as well as in Dropdown ?

Should I attach wp-list-categories to the <ul> tag?

I think I may have misunderstood your context when I replied earlier, so I’ve deleted that part in this reply and will leave you with this:

What I’d do is put it in, run the change in Chrome (or your favourite) and use developer tools to see what is generated and therefore what element you need to add to the CSS to. Hope that helps!

@Regi what about this https://codex.wordpress.org/Function_Reference/wp_dropdown_categories or is using the built in Categories option in Menus and option https://wptavern.com/how-to-create-a-dropdown-menu-of-wordpress-categories-without-using-code