gtm4wp_body_class

The Google Tag Manager for WordPress gtm4wp body class function.

Description

gtm4wp_body_class( $classes ); 

Parameters (1)

0. $classes
The classes.

Usage

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

Defined (1)

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

/public/frontend.php  
  1. function gtm4wp_body_class( $classes ) { 
  2. global $gtm4wp_options; 
  3.  
  4. // solution is based on the code of Yaniv Friedensohn 
  5. // http://www.affectivia.com/blog/placing-the-google-tag-manager-in-wordpress-after-the-body-tag/ 
  6. $classes[] = '">' . gtm4wp_get_the_gtm_tag() . '<br style="display:none;'; 
  7.  
  8. return $classes;