monsterinsights_load_admin_partial

Loads a partial view for the Administration screen.

Description

monsterinsights_load_admin_partial( (string) $template, (array) $data = array() ); 

Parameters (2)

0. $template (string)
PHP file at includes/admin/partials, excluding file extension
1. $data — Optional. (array) => array()
Any data to pass to the view

Usage

  1. if ( !function_exists( 'monsterinsights_load_admin_partial' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/admin/admin.php'; 
  3.  
  4. // PHP file at includes/admin/partials, excluding file extension 
  5. $template = ''; 
  6.  
  7. // Any data to pass to the view 
  8. $data = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = monsterinsights_load_admin_partial($template, $data); 
  12.  

Defined (1)

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

/includes/admin/admin.php  
  1. function monsterinsights_load_admin_partial( $template, $data = array() ) { 
  2. // Get the base class object. 
  3. $base = MonsterInsights(); 
  4.  
  5. $dir = trailingslashit( plugin_dir_path( $base->file ) . 'pro/includes/admin/partials' ); 
  6.  
  7. if ( file_exists( $dir . $template . '.php' ) ) { 
  8. require_once( $dir . $template . '.php' ); 
  9. return true; 
  10. } else { 
  11. $dir = trailingslashit( plugin_dir_path( $base->file ) . 'lite/includes/admin/partials' ); 
  12.  
  13. if ( file_exists( $dir . $template . '.php' ) ) { 
  14. require_once( $dir . $template . '.php' ); 
  15. return true; 
  16. }  
  17.  
  18. $dir = trailingslashit( plugin_dir_path( $base->file ) . 'includes/admin/partials' ); 
  19.  
  20. if ( file_exists( $dir . $template . '.php' ) ) { 
  21. require_once( $dir . $template . '.php' ); 
  22. return true; 
  23.  
  24. return false;