layers_admin_scripts

The Layers layers admin scripts function.

Description

layers_admin_scripts(); 

Usage

  1. if ( !function_exists( 'layers_admin_scripts' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = layers_admin_scripts(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function layers_admin_scripts() { 
  2. global $pagenow, $wp_customize; 
  3.  
  4. /** 
  5. * Tip-Tip (renamed to layerTip ) 
  6. */ 
  7. wp_enqueue_style( 
  8. LAYERS_THEME_SLUG . '-tip-tip' ,  
  9. get_template_directory_uri() . '/core/assets/plugins/tip-tip/jquery.tipTip.css',  
  10. array(),  
  11. ); 
  12. wp_enqueue_script( 
  13. LAYERS_THEME_SLUG . '-tip-tip' ,  
  14. get_template_directory_uri() . '/core/assets/plugins/tip-tip/jquery.tipTip.js',  
  15. array( 'jquery' ),  
  16. true 
  17. ); 
  18.  
  19. /** 
  20. * LayersSlct2 (also enqueued by Storekit and WooCommerce). 
  21. */ 
  22. wp_enqueue_style( 
  23. 'layersSlct2',  
  24. get_template_directory_uri() . '/core/assets/plugins/select2/layersSlct2.css',  
  25. array(),  
  26. ); 
  27. wp_enqueue_style( 
  28. 'layersSlct2-skins',  
  29. get_template_directory_uri() . '/core/assets/plugins/select2/layersSlct2-skins.css',  
  30. array(),  
  31. ); 
  32. wp_enqueue_script( 
  33. 'layersSlct2',  
  34. get_template_directory_uri() . '/core/assets/plugins/select2/layersSlct2.js',  
  35. array( 'jquery' ),  
  36. ); 
  37.  
  38. /** 
  39. * FontAwesome 
  40. */ 
  41. wp_enqueue_style( 
  42. LAYERS_THEME_SLUG . '-admin-font-awesome',  
  43. get_template_directory_uri() . '/core/assets/plugins/font-awesome/font-awesome.min.css',  
  44. array(),  
  45. ); 
  46.  
  47.  
  48. /** 
  49. * Main Admin CSS's 
  50. */ 
  51. wp_enqueue_style( 
  52. LAYERS_THEME_SLUG . '-global',  
  53. get_template_directory_uri() . '/core/assets/layers-global.css',  
  54. array(),  
  55. ); 
  56.  
  57. if ( isset( $wp_customize ) ) { 
  58.  
  59. /** 
  60. * Admin Customizer (only) 
  61. */ 
  62. wp_enqueue_style( 
  63. LAYERS_THEME_SLUG . '-customizer',  
  64. get_template_directory_uri() . '/core/assets/layers-customizer.css',  
  65. array(),  
  66. ); 
  67. else { 
  68.  
  69. /** 
  70. * Admin Dashboard (only) 
  71. */ 
  72. wp_enqueue_style( 
  73. LAYERS_THEME_SLUG . '-admin',  
  74. get_template_directory_uri() . '/core/assets/layers-admin.css',  
  75. array(),  
  76. ); 
  77.  
  78.  
  79. /** 
  80. * Admin Editor 
  81. */ 
  82. wp_enqueue_style( 
  83. LAYERS_THEME_SLUG . '-admin-editor',  
  84. get_template_directory_uri() . '/core/assets/plugins/froala/editor.css',  
  85. array(),  
  86. ); 
  87. wp_enqueue_script( 
  88. LAYERS_THEME_SLUG . '-admin-editor' ,  
  89. get_template_directory_uri() . '/core/assets/plugins/froala/editor.min.js' ,  
  90. array( 'jquery' ),  
  91. true 
  92. ); 
  93.  
  94.  
  95. /** 
  96. * Admin Migrator 
  97. */ 
  98. wp_enqueue_script( 
  99. LAYERS_THEME_SLUG . '-admin-migrator' ,  
  100. get_template_directory_uri() . '/core/assets/migrator.js' ,  
  101. array( 
  102. 'media-upload' 
  103. ),  
  104. true 
  105. ); 
  106. wp_localize_script( 
  107. LAYERS_THEME_SLUG . '-admin-migrator',  
  108. 'migratori18n',  
  109. array( 
  110. 'loading_message' => __( 'Be patient while we import the widget data and images.' , 'layerswp' ),  
  111. 'complete_message' => __( 'Import Complete' , 'layerswp' ),  
  112. 'importing_message' => __( 'Importing Your Content' , 'layerswp' ),  
  113. 'duplicate_complete_message' => __( 'Edit Your New Page' , 'layerswp' ) 
  114. ); 
  115. wp_localize_script( 
  116. LAYERS_THEME_SLUG . '-admin-migrator',  
  117. "layers_migrator_params",  
  118. array( 
  119. 'duplicate_layout_nonce' => wp_create_nonce( 'layers-migrator-duplicate' ),  
  120. 'import_layout_nonce' => wp_create_nonce( 'layers-migrator-import' ),  
  121. 'preset_layout_nonce' => wp_create_nonce( 'layers-migrator-preset-layouts' ),  
  122. ); 
  123.  
  124.  
  125. /** 
  126. * Discover More Photos 
  127. */ 
  128. wp_enqueue_script( 
  129. LAYERS_THEME_SLUG . '-media-views' ,  
  130. get_template_directory_uri() . '/core/assets/media-views.js',  
  131. array( 
  132. 'media-views' 
  133. ),  
  134. ); 
  135.  
  136.  
  137. /** 
  138. * Admin Onboarding 
  139. */ 
  140. wp_enqueue_script( 
  141. LAYERS_THEME_SLUG . '-admin-onboarding' ,  
  142. get_template_directory_uri() . '/core/assets/onboarding.js',  
  143. array( 
  144. 'jquery' 
  145. ),  
  146. true 
  147. ); 
  148. wp_localize_script( 
  149. LAYERS_THEME_SLUG . '-admin-onboarding' ,  
  150. "layers_onboarding_params",  
  151. array( 
  152. 'preset_layout_nonce' => wp_create_nonce( 'layers-migrator-preset-layouts' ),  
  153. 'update_option_nonce' => wp_create_nonce( 'layers-onboarding-update-options' ),  
  154. 'set_theme_mod_nonce' => wp_create_nonce( 'layers-onboarding-set-theme-mods' ),  
  155. ); 
  156. wp_localize_script( 
  157. LAYERS_THEME_SLUG . '-admin-onboarding' ,  
  158. 'onboardingi18n',  
  159. array( 
  160. 'step_saving_message' => __( 'Saving...' , 'layerswp' ),  
  161. 'step_done_message' => __( 'Done!' , 'layerswp' ) 
  162. ); 
  163.  
  164.  
  165. /** 
  166. * Admin JS 
  167. */ 
  168. wp_enqueue_script( 
  169. LAYERS_THEME_SLUG . '-admin' ,  
  170. get_template_directory_uri() . '/core/assets/admin.js',  
  171. array( 
  172. 'jquery',  
  173. 'jquery-ui-sortable',  
  174. 'wp-color-picker',  
  175. ),  
  176. true 
  177. ); 
  178. wp_localize_script( 
  179. LAYERS_THEME_SLUG . '-admin' ,  
  180. 'layers_admin_params',  
  181. array( 
  182. 'backup_pages_nonce' => wp_create_nonce( 'layers-backup-pages' ),  
  183. 'backup_pages_success_message' => __('Your pages have been successfully backed up!', 'layerswp' ),  
  184. 'nonce_layers_widget_linking' => wp_create_nonce( 'nonce_layers_widget_linking' ),  
  185. ); 
  186.  
  187. wp_enqueue_media(); 
  188.