Skip to content

Commit b419ae2

Browse files
author
David Ryan
committed
2 parents 18852cc + 88a983d commit b419ae2

File tree

3 files changed

+29
-41
lines changed

3 files changed

+29
-41
lines changed

docs/best-practices-frontend-deps.md renamed to docs/best-practices-asset-management.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# WordPress Frontend Dependency Best Practices
1+
# WordPress Asset Management Best Practices
22

33
#### Break `wp_register_script()` and `wp_register_style()` arguments onto their own lines
44

@@ -22,7 +22,7 @@ When registering CSS or JS within a PHP class, always store the asset handle as
2222

2323
#### Leverage dependency chaining and the `array()` method for `wp_enqueue_*()`
2424

25-
A common place that can feel repetitive is registering and initializing enqueued assets. Make sure you make good, appropriate forcing order and perhaps enqueue of dependencies via `wp_register_*`'s `$dependency` parameter.
25+
A common place that can feel repetitive is registering and initializing enqueued assets. Perhaps trigger enqueue of dependencies via `wp_register_*`'s `$dependency` parameter.
2626

2727
Also, if enqueueing multiple scripts or styles simultaneously, use a single `wp_enqueue_script()` or `wp_enqueue_style()` with an array of dependency slugs to avoid repetition.
2828

@@ -51,5 +51,5 @@ WordPress does little to prevent the collision of scripts. Short of defining dep
5151

5252
Plus at time of writing it's 2017 and React and Vue-based apps, use of JavaScript tools is becoming more prevalent. Some of these authors create a rollup file of dependencies and a rollup of their app. Even in an environment you control, you likely rely on some 3rd party plugins that load dependencies.
5353

54-
### Provide a version string for caching
55-
We recommend tying product assets the version for the Theme or Plugin you're in. Having a condition that checks for local environments (i.e. check request string for ".test") and toggling between a production version and a rand(0,PHP_INT_MAX) is another good option.
54+
#### Provide a version string for caching
55+
We recommend tying product assets the version for the Theme or Plugin you're in. Having a condition that checks for local environments (i.e. check request string for ".test") and toggling between a production version and a `rand(0,PHP_INT_MAX)` is another good option.

docs/resources.md

Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11

22

3-
# Great Enterprise-Grade WordPress & Web Development Resources
3+
### Great Enterprise-Grade WordPress & Web Development Resources
44

55
* [WordPress The Right Way](https://www.wptherightway.org/en/getting_started/) - [PDF](https://www.gitbook.com/download/pdf/book/tomjn/wordpress-the-right-way?lang=en)
66

7-
* WordPress Action & Filter Reference [https://codex.wordpress.org/Plugin_API/Action_Reference]
8-
* GenerateWP.com -- Interactive tools for creating Core API queries and WordPress File Headers
9-
* https://github.com/kamranahmedse/design-patterns-for-humans
7+
* [WordPress Action & Filter Reference](https://codex.wordpress.org/Plugin_API/Action_Reference)
8+
* [GenerateWP.com](https://generatewp.com) -- Interactive tools for creating Core API queries and WordPress File Headers
9+
* [Design Patterns for Humans](https://github.com/kamranahmedse/design-patterns-for-humans)
1010

11-
* 10Up Engineering Standards & Best Practices (forked XWP copy of standards)
12-
* WordPress.com VIP "What We Look For"
13-
* Locutus.io/php -- Common PHP methods ported to JavaScript.
14-
* YouMightNotNeedjQuery.com -- An explainer on using native JavaScript alternatives to jQuery.
11+
* [10Up Engineering Standards & Best Practices](https://10up.github.io/Engineering-Best-Practices/) [(forked XWP copy of standards)](https://xwp.github.io/engineering-best-practices/)
12+
* [WordPress.com VIP "What We Look For"](https://vip.wordpress.com/documentation/code-review-what-we-look-for/)
13+
* [Locutus.io/php](https://locutus.io/php) -- Common PHP methods ported to JavaScript.
14+
* [YouMightNotNeedjQuery.com](http://youmightnotneedjquery.com) -- An explainer on using native JavaScript alternatives to jQuery.
1515

16-
Great Topical Guides / Blogs
16+
### Great Topical Guides / Blogs
1717
* [Understanding WordPress Directory Structure](https://www.rarst.net/wordpress/directory-structure/)
18-
* 10 WordPress Things I've Learned Working With 10Up[http://rachievee.com/10-wordpress-things-ive-learned-working-with-10up/]
19-
* Intro to Underscore.js Templates in WordPress [https://themehybrid.com/weblog/intro-to-underscore-js-templates-in-wordpress]
20-
* On using `apply_filters( 'the_content' )` in the loop or rolling a custom version [https://themehybrid.com/weblog/how-to-apply-content-filters]
21-
* Introduction to WordPress Term Meta API [https://themehybrid.com/weblog/introduction-to-wordpress-term-meta]
22-
* Using Shortcode Attributes [https://pippinsplugins.com/shortcodes-101-shortcode-attributes/]
23-
* Using Template Files for Better Frontend Shortcodes
24-
[https://pippinsplugins.com/shortcodes-101-using-template-files-better-shortcodes/]
25-
* On Checking Plugin, Class and Method Dependencies [https://pippinsplugins.com/checking-dependent-plugin-active/]
26-
* On the WordPress Heartbeat API [https://pippinsplugins.com/using-the-wordpress-heartbeat-api/]
27-
* WordPlate Helpers [https://wordplate.github.io/docs/helpers]
28-
29-
Little-used/documented WordPress Core JavaScript
18+
* [10 WordPress Things I've Learned Working With 10Up](http://rachievee.com/10-wordpress-things-ive-learned-working-with-10up/)
19+
* [Intro to Underscore.js Templates in WordPress](https://themehybrid.com/weblog/intro-to-underscore-js-templates-in-wordpress)
20+
* [On using `apply_filters( 'the_content' )` in the loop or rolling a custom version](https://themehybrid.com/weblog/how-to-apply-content-filters)
21+
* [Introduction to WordPress Term Meta API](https://themehybrid.com/weblog/introduction-to-wordpress-term-meta)
22+
* [Using Shortcode Attributes](https://pippinsplugins.com/shortcodes-101-shortcode-attributes/)
23+
* [Using Template Files for Better Frontend Shortcodes](https://pippinsplugins.com/shortcodes-101-using-template-files-better-shortcodes/)
24+
* [On Checking Plugin, Class and Method Dependencies](https://pippinsplugins.com/checking-dependent-plugin-active/)
25+
* [On the WordPress Heartbeat API](https://pippinsplugins.com/using-the-wordpress-heartbeat-api/)
26+
* [WordPlate Helpers](https://wordplate.github.io/docs/helpers)
27+
28+
### Little-used/documented WordPress Core JavaScript
3029
* wp.template() -- A simple implementation of underscore.js' `_.template()` method.
3130
* wp.shortcode.next() -- Parse shortcode string into data object using JavaScript.
3231
* wp.shortcode.string() -- Generate a WordPress shortcode string using JavaScript data.
@@ -38,7 +37,7 @@ Little-used/documented WordPress Core JavaScript
3837
* wp.emoji.test() - Test if a string contains emoji.
3938
* wpCookie.get(), wpCookie.set(), wpCookie.remove() - Cookie CRUD tools
4039

41-
# On Leveraging Stack Overflow, The WordPress Codex and Search-Sourced Solutions
40+
### On Leveraging Stack Overflow, The WordPress Codex and Search-Sourced Solutions
4241

4342
Stack Overflow, The Codex and Solutions found on blogs are often excellent starting points to learn and develop solutions. However, many solutions aren't written to consider enterprise needs, high-traffic sites or large-scale environments.
4443

@@ -50,23 +49,10 @@ When integrating someone else's solution, please consider the following:
5049
* Is this functionality "right-sized?" Perhaps break large procedural functions into helpers.
5150
* Does the author properly sanitize and validate user input while late-escaping output?
5251

53-
# Helpful Utility/Development Plugins
52+
### Helpful Utility/Development Plugins
5453
* [FakerPress](https://wordpress.org/plugins/fakerpress/) - Generate Fake WordPress Data (optionally use 500px for real, varied featured post images)
5554
* [Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/) - Regenerate Thumbnails after
5655
changing Thumbnail Sizes
5756
* [P3 Plugin Profiler](https://wordpress.org/plugins/p3-profiler/) - Tool to better understand plugin performance
5857
* [Locomotive](https://github.com/reaktivstudios/locomotive) - Simple, repeatable batch process tasks for wordpress
59-
60-
# Helpful Open-Source Resources for Enterprise-Ready WordPress Code
61-
(not all code available in these organizations is "enterprise ready for everyone", however, there are many good examples for many kinds of enterprises)
62-
* https://github.com/10up
63-
* https://github.com/crowdfavorite
64-
* https://github.com/xwp
65-
* https://github.com/humanmade
66-
* https://github.com/automattic
67-
* https://github.com/Automattic/vip-go-mu-plugins-built
68-
* https://github.com/easydigitaldownloads/easy-digital-downloads
69-
* https://github.com/stuttter
70-
* https://github.com/washingtonstateuniversity
71-
* https://github.com/webdevstudios
72-
* https://github.com/dfmedia
58+
* [Query Monitor](https://wordpress.org/plugins/query-monitor/) - Debug WordPress deeply in any environment. Detect every running action, filter, registered script, environment configuration, simple PHP errors and evaluate long-running database queries.

docs/security.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# On WordPress Security
22

3+
### THIS PAGE NEEDS FORMATTING AND COMPLETION, PRs welcome!
4+
35
* Using Nonces
46

57
The primary security mechanism in WordPress is nonces. Nonces are time-stamped and tap into the logged-in user cookie. All nonces in the WordPress Admin leveraging the REST API should use the `wp_rest` action ( `wp_create_nonce('wp_rest')` ) and be passed via either the `_wpnonce` data param (GET or POST) or the `X-WP-Nonce` header.

0 commit comments

Comments
 (0)