Hopefully I can make this thread the official sidebar thread
I’m trying to create a sidebar navigation menu for the WooCommerce account page (or endpoint). This sidebar is just a static navigation that includes links to all of the account endpoints, creating a better UX. I want the sidebar floated left, its currently floated right by default.
Just for reference there’s a few resources already out there on the sidebar:
Here’s what I think the workflow should look like:
Register a new sidebar in lib/widgets.php
Register a new menu in lib/init.php
Setup menu links in WP menu admin.
Update your sidebar in the WP widgets admin panel, make it your menu.
Create a new page template “page-account” and call the sidebar.
Ensure that the sidebar is show by correctly modifying the sidebar array in config.php and including the conditional tag: array('is_page', array('account')). In this instance I reversed the logic of the conditional tag checks as theres only a few templates which require any sidebar at all.
Does anyone have a better / simpler implementation. This seems like a lot of work to build a simple sidebar nav. I’m probably better off hardcoding it as it will never change.
Good idea for a sidebar thread, however I think the search function on the forum is pretty decent and has that covered. Also, not to burst your bubble, but I think your subject is very specific and therefore unlikely to become a dedicated and sticky sidebar thread. If such a thread was deemed necessary it would probably be called “The Roots Sidebar Thread” or something similarly generic.
To address your specific question, I think the best place to add a new sidebar and nav menu code is either custom.php or separate custom code files within lib/ which you include inside custom.php.
I think the search function on the forum is pretty decent and has that covered
I suppose if that were true there wouldn’t be so many questions about the sidebar. I’ve seen plenty of them in the old google group, as well as on this discourse forum, and even in the comments on the roots.io blog article that explains the sidebar.
I’ll start compiling the questions, but I guess the reason I had the idea to create a sticky was that my specific application includes 3-4 common questions / problems that people have run into.