function admin_enqueue_script($hook) { //Only include the javascript in our page if ($hook != 'appearance_page_snazzy_maps') { return; } //Include the javascript $handle = 'admin-snazzymaps-js'; wp_enqueue_script($handle, plugins_url('index.js', __FILE__), $deps = array('jquery'), $ver = SNAZZY_VERSION_NUMBER); wp_localize_script($handle, 'SnazzyData', array('API_KEY' => API_KEY, 'API_BASE' => API_BASE, 'USER_API_KEY' => get_option('MySnazzyAPIKey', null))); //Include the node modules $node_modules = array('query-string' . _DS . 'query-string.js', 'mustache' . _DS . 'mustache.min.js'); foreach ((array) $node_modules as $index => $node_module) { wp_enqueue_script("admin-node-module-{$index}", resourceURL('node_modules' . _DS . $node_module), $deps = array(), $ver = SNAZZY_VERSION_NUMBER); } //Include the bower components $bower_components = array('history.js' . _DS . 'scripts' . _DS . 'bundled' . _DS . 'html5' . _DS . 'native.history.js'); foreach ((array) $bower_components as $index => $bower_component) { wp_enqueue_script("admin-bower-component-{$index}", resourceURL('bower_components' . _DS . $bower_component), $deps = array(), $ver = SNAZZY_VERSION_NUMBER); } //Include the css wp_enqueue_style('admin-snazzymaps-css', plugins_url('index.css', __FILE__), $deps = array(), $ver = SNAZZY_VERSION_NUMBER); }
function publishHTMLInclude($name) { $type = substr($name, strrpos($name, '.') + 1); $url = resourceURL($type, $name); if ($type === 'js') { publish('<script src="' . $url . '" type="text/javascript"></script>'); } else { publish('<link href="' . $url . '" type="text/css" rel="stylesheet">'); } }
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Sucel</title> <link rel="stylesheet" href="<?php echo resourceURL('css/reset.css'); ?> "/> </head> <body> <?php echo $content; ?> </body> </html>