Naming conventions - wpeka/wpadcenter GitHub Wiki
Table of Contents
PHP
WPAdCenter core follows WordPress PHP naming conventions. On top of that, function, class, and hook names should be prefixed. For functions the prefix is wpadcenter_
, for classes is Wpadcenter_
and for hooks is wpadcenter_
.
Function name examples:
wpadcenter_get_settings()
wpadcenter_is_subdir()
Class name examples:
Wpadcenter_Adsense
Wpadcenter_Single_Ad_Widget
Hook name examples (actions or filters):
wpadcenter_save_ad_meta
wpadcenter_get_default_metafields
JS
WPAdCenter core follows WordPress JS naming conventions. As with PHP, function, class, and hook names should be prefixed, but the convention for JS is slightly different, and camelCase is used instead of snake_case. For functions, the prefix is wpadcenter
, for classes is Wpadcenter
and for hooks is wpadcenter
.
CSS and SASS
As a WordPress plugin WPAdCenter has to play nicely with WordPress core and other plugins / themes. To minimise conflict potential all classes should be prefixed with .wpadcenter-
.
- Follow the WP Coding standards for CSS unless it contradicts anything here.
- Use BEM for class names.
- Prefix all the things.