10/8/2023 0 Comments Javascript coding![]() Many parts of the WordPress code structure for JavaScript are inconsistent in their style. “ Code refactoring should not be done just because we can.” – Lead Developer Andrew Nacin Any of the below standards and examples should be considered best practice for WordPress code, unless explicitly noted as anti-patterns. Many of the examples below have been adapted directly from the jQuery style guide these differences have all been integrated into the examples on this page. jQuery’s 100-character hard line limit is encouraged, but not strictly enforced.Some whitespace rules differ, for consistency with the WordPress PHP coding standards.Function contents are consistently indented, including full-file closure wrappers.Case statements are indented within switch blocks.WordPress uses single quotation marks for string declarations.Our standard differs from the jQuery guidelines in the following ways: The WordPress JavaScript Coding Standards are adapted from the jQuery JavaScript Style Guide. ![]() – Principles of Writing Consistent, Idiomatic JavaScript Standards are needed for formatting and styling JavaScript code to maintain the same code consistency as the WordPress standards provide for core PHP, HTML, and CSS code.Īll code in any code-base should look like a single person typed it, no matter how many people contributed. JavaScript has become a critical component in developing WordPress-based applications (themes and plugins) as well as WordPress core.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |