gtm4wp_add_admin_js

The Google Tag Manager for WordPress gtm4wp add admin js function.

Description

gtm4wp_add_admin_js( $hook ); 

Parameters (1)

0. $hook
The hook.

Usage

  1. if ( !function_exists( 'gtm4wp_add_admin_js' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-tag-manager-for-wordpress/admin/admin.php'; 
  3.  
  4. // The hook. 
  5. $hook = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = gtm4wp_add_admin_js($hook); 
  9.  

Defined (1)

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

/admin/admin.php  
  1. function gtm4wp_add_admin_js($hook) { 
  2. global $gtp4wp_plugin_url; 
  3.  
  4. if ( $hook == "settings_page_" . GTM4WP_ADMINSLUG ) { 
  5. wp_register_script( "admin-subtabs", $gtp4wp_plugin_url . "js/admin-subtabs.js" ); 
  6.  
  7. $subtabtexts = array( 
  8. "posttabtitle" => __( "Posts" , 'duracelltomi-google-tag-manager' ),  
  9. "searchtabtitle" => __( "Search" , 'duracelltomi-google-tag-manager' ),  
  10. "visitortabtitle" => __( "Visitors" , 'duracelltomi-google-tag-manager' ),  
  11. "adwordstabtitle" => __( "AdWords" , 'duracelltomi-google-tag-manager' ),  
  12. "browsertabtitle" => __( "Browser/OS/Device" , 'duracelltomi-google-tag-manager' ),  
  13. "blocktagstabtitle" => __( "Blacklist tags" , 'duracelltomi-google-tag-manager' ),  
  14. "blockmacrostabtitle" => __( "Blacklist macros" , 'duracelltomi-google-tag-manager' ),  
  15. "wpcf7tabtitle" => __( "Contact Form 7" , 'duracelltomi-google-tag-manager' ),  
  16. "wctabtitle" => __( "WooCommerce" , 'duracelltomi-google-tag-manager' ),  
  17. "weathertabtitle" => __( "Weather data" , 'duracelltomi-google-tag-manager' ),  
  18. "generaleventstabtitle" => __( "General events" , 'duracelltomi-google-tag-manager' ),  
  19. "mediaeventstabtitle" => __( "Media events" , 'duracelltomi-google-tag-manager' ),  
  20. "depecratedeventstabtitle" => __( "Deprecated" , 'duracelltomi-google-tag-manager' ),  
  21. "sitetabtitle" => __( "Site" , 'duracelltomi-google-tag-manager' ) 
  22. ); 
  23. wp_localize_script( "admin-subtabs", 'gtm4wp', $subtabtexts ); 
  24. wp_enqueue_script( "admin-subtabs" ); 
  25.  
  26. wp_enqueue_script( "admin-tabcreator", $gtp4wp_plugin_url . "js/admin-tabcreator.js", array( "jquery-core" ), "1.0" ); 
  27.  
  28. wp_enqueue_style( "gtm4wp-validate", $gtp4wp_plugin_url . "css/admin-gtm4wp.css", array(), "1.0" );