Answers for "admin_enqueue_scripts specific page"

0

admin_enqueue_scripts specific page

add_action('admin_menu', function () {
  $settingsPage = add_options_page('Settings', 'Mortgage Calculator', 'manage_options', 'mortgagecalculator', function () {
    echo "<div id='app'></div>";
  });
  /**
   * Include the ember admin scripts only on pages where it's needed.
   */
  add_action("admin_enqueue_scripts", function ($hook) use ($settingsPage){
    if($hook !== $settingsPage){
      return;
    }
    // Remove default jQuery since Ember provides its own.
    wp_dequeue_script('jquery');
    wp_enqueue_script('ember-vendor', plugins_url("admin/assets/vendor.js", __FILE__));
    wp_enqueue_script('ember-project', plugins_url("admin/assets/mortgage-plugin-ember-admin.js", __FILE__), ['ember-vendor']);
    wp_enqueue_script('ember-live-reload', "http://localhost:4200/ember-cli-live-reload.js");
  });
});
Posted by: Guest on August-27-2021
0

admin_enqueue_scripts specific page

function my_enqueue($hook) {
if ( 'bookings' != $hook ) {
    return;
}
if ( is_admin() ) {
wp_enqueue_style('datatablecss','//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' );
wp_enqueue_style('datatablecss2','//cdn.datatables.net/1.10.16/css/dataTables.bootstrap.min.css' );
wp_enqueue_script('datatablejs','//cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js',array(),'1.0',false);
wp_enqueue_script('datatablejs2','//cdn.datatables.net/1.10.16/js/dataTables.bootstrap.min.js',array(),'1.0',false);}
add_action( 'wp_enqueue_scripts', 'my_enqueue' );
}
Posted by: Guest on August-27-2021

Code answers related to "admin_enqueue_scripts specific page"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language