Skip to content

Commit 9bd5f9c

Browse files
committed
Adds documentation for WordPress.WP.EnqueuedResources.
1 parent 2f396d1 commit 9bd5f9c

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<documentation title="Enqueued Resources">
2+
<standard>
3+
<![CDATA[
4+
Scripts must be registered/enqueued via wp_enqueue_script().
5+
]]>
6+
</standard>
7+
<code_comparison>
8+
<code title="Valid: Script registered and enqueued correctly.">
9+
<![CDATA[
10+
<em>wp_enqueue_script</em>(
11+
'someScript-js',
12+
$path_to_file,
13+
array( 'jquery' ),
14+
'1.0.0',
15+
true
16+
);
17+
]]>
18+
</code>
19+
<code title="Invalid: Script is directly embedded in HTML.">
20+
<![CDATA[
21+
printf(
22+
'<em><script src="%s"></script></em>',
23+
esc_url( $path_to_file )
24+
);
25+
]]>
26+
</code>
27+
</code_comparison>
28+
<standard>
29+
<![CDATA[
30+
Stylesheets must be registered/enqueued via wp_enqueue_style().
31+
]]>
32+
</standard>
33+
<code_comparison>
34+
<code title="Valid: Stylesheet registered and enqueued correctly.">
35+
<![CDATA[
36+
<em>wp_enqueue_style</em>(
37+
'style-name',
38+
$path_to_file,
39+
array(),
40+
'1.0.0'
41+
);
42+
]]>
43+
</code>
44+
<code title="Invalid: Stylesheet is directly embedded in HTML.">
45+
<![CDATA[
46+
printf(
47+
'<em><link rel="stylesheet" href="%s" /></em>',
48+
esc_url( $path_to_file )
49+
);
50+
]]>
51+
</code>
52+
</code_comparison>
53+
</documentation>

0 commit comments

Comments
 (0)