In this way you don't need in-line scripts nevermore. usually wpfooter() is located in the footer.php, just before the. do some stuff with oFoo (no PHP needed) note that the difference between getfooter() and wpfooter() is that getfooter() calls the template file footer.php, while wpfooter() is an action performed by wordpress to insert every javascript and style that are defined to appear in the footer. * bool $in_footer (optional) Whether to enqueue the script before or before įunction enqueue_inline_script( $handle, $js, $deps = array(), $in_footer = false ) * array $deps (optional) Array of script names on which this script depends * string $handle Identifying name for script * placed in header, and the dependant in footer). And always load/enqueue scripts and styles via the wpenqueuescripts action hook, as this is the proper hook to use. '/js/creative-blog-custom.js', array ('jquery'), null, true) // Here in this example the last value has been set as true, so, it will be loaded in the. * any inline scripts it depends on, (unless they are Here, below is the example provided about how we enqueue the JavaScript files in the header or in the footer area: wpenqueuescript ('creative-blog-main-script', gettemplatedirectoryuri (). * KNOWN BUG: Inline scripts cannot be enqueued before This solution is similar to answer, but it follows the form of wp_enquque_script(), and will place the script in the header if its dependencies are included in the header.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |