39 | | [[BR]]wp_enqueue_resource(‘Resource-1’) would: |
40 | | [[BR]]wp_enqueue _script(‘Resource-1’, ‘Script-1-URL’, array(’Script-1-A’,’Script-1-B’)); |
41 | | [[BR]]wp_enqueue _style(‘Resource-1’, ‘Style-1-URL’, array(Style-1-A’, Style-1-B’)); |
42 | | */ |
| 39 | do not call wp_register_style/ wp_register_script upon registering of the resource and wait until this resources or resource requiring this resource is enqueued. This way the style and script are not enqueued separate from the resource and therefore each other since they are dependent on each other. It would however register the resource in the resource queue. |
| 40 | |
| 41 | {{{ |
| 42 | wp_enqueue_resource(‘Resource-1’) would: |
| 43 | wp_enqueue _script(‘Resource-1’, ‘Script-1-URL’, array(’Script-1-A’,’Script-1-B’)); |
| 44 | wp_enqueue _style(‘Resource-1’, ‘Style-1-URL’, array(Style-1-A’, Style-1-B’)); |
| 45 | }}} |
| 67 | }}} |
| 68 | |
| 69 | {{{ |
| 70 | wp_enqueue_resource(‘Resource-2’) would: |
| 71 | wp_register_script(‘Resource-1’,’Scipt-1-URL’……) |
| 72 | wp_register_style(‘Resource-1’,’Style-1-URL’……) |
| 73 | wp_enqueue_script(‘Resource-2’, ‘Script-1-URL’, array(‘Resource-1’,’Script-1-A’,’Script-1-B’)) |
| 74 | wp_enqueue_style(‘Resource-2’, ‘’, array(‘Resource-1’)) |
| 75 | }}} |
65 | | wp_enqueue_resource(‘Resource-2’) would: |
66 | | [[BR]]wp_register_script(‘Resource-1’,’Scipt-1-URL’……) |
67 | | [[BR]]wp_register_style(‘Resource-1’,’Style-1-URL’……) |
68 | | [[BR]]wp_enqueue_script(‘Resource-2’, ‘Script-1-URL’, array(‘Resource-1’,’Script-1-A’,’Script-1-B’)) |
69 | | [[BR]]wp_enqueue_style(‘Resource-2’, ‘’, array(‘Resource-1’)) |
70 | | |
71 | | [[BR]][[BR]]wp_deenqueue_resource(‘Resource-2’) |
72 | | [[BR]]would take dequeue it’s scripts and dependent scripts/styles (assuming those dependent scripts and styles were not enqueued elsewhere) |
| 78 | `wp_deenqueue_resource(‘Resource-2’)` would take dequeue it’s scripts and dependent scripts/styles (assuming those dependent scripts and styles were not enqueued elsewhere) |