Coding standard
sakinshrestha opened this issue · comments
- Menu IDs should take the format of menu-1, menu-2, etc. Reason: Consistency across themes means that a user can switch themes and not have to reassign their menu to the theme’s menu location. It also allows easier readability in code.
- Check
functions.php
line 55
- Check
- Widget IDs should take the format of sidebar-1, sidebar-2, etc. Reason: Consistency across themes means that a user can switch themes and not have to reassign their widgets to the theme’s widget locations. It also allows for easier readability in code.
- Check function
sitepointbasetheme_widgets_init()
infunctions.php
file
- Check function
I actually want to comment and say that I disagree with Sakin here. Numeric IDs are harder to remember when coding. Unique names are far easier for me to remember. So, it's a difference in philosophy. :)
Additionally, menus don't work like that. Sidebars do but menus don't. Menus are tied to a specific theme. And, even though sidebars do work like that, there's no standard naming scheme that most theme authors follow.
I think it's best to find something that you can consistently use as a developer. I personally use primary
, secondary
, etc. when naming menu locations and sidebars.
Justin, actually I have taken this from Theme User Experience Requirements
I agree with you that it's difficult to remember numeric names but this is recommended as for consistency between themes. Also since this is base theme, I think this should be used.