title: How to remove all style and JavaScript and include new one in wordpress
body: <p>I am working on a legacy wp theme and have some lovely clean new CSS and js I want to apply to set template.</p>
  
  <p>I have managed to remove old CSS and js from being applied to my new template using the script below.</p>
  
  <p>However, how can I add new script and style to these functions whilst removing old?</p>
  
  <p>For example, remove all old CSS and js now add these js and CSS</p>
  
  <pre><code>    /**
   * Remove all java scripts.
   */
  function se_remove_all_scripts() {
      global $wp_scripts;
      if ( is_page_template( 'new-template/page-main.php' ) ) {
          $wp_scripts-&gt;queue = array();
      }
  }
  
  /**
   * Remove all style sheets.
   */
  function se_remove_all_styles() {
      global $wp_styles;
      if ( is_page_template( 'new-template/page-main.php' ) ) {
          $wp_styles-&gt;queue = array();
      }
  }
  
  add_action( 'wp_print_styles', 'se_remove_all_styles', 99 );
  
  add_action( 'wp_print_scripts', 'se_remove_all_scripts', 99 );
  </code></pre>