pmpro_wp

The Paid Memberships Pro pmpro wp function.

Description

pmpro_wp(); 

Usage

  1. if ( !function_exists( 'pmpro_wp' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'paid-memberships-pro/includes/init.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pmpro_wp(); 
  7.  

Defined (1)

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

/includes/init.php  
  1. function pmpro_wp() 
  2. if(!is_admin()) 
  3. global $post, $pmpro_pages, $pmpro_core_pages, $pmpro_page_name, $pmpro_page_id, $pmpro_body_classes;  
  4.  
  5. //no pages yet? 
  6. if(empty($pmpro_pages)) 
  7. return; 
  8.  
  9. //run the appropriate preheader function 
  10. foreach($pmpro_core_pages as $pmpro_page_name => $pmpro_page_id) 
  11. if(!empty($post->post_content) && strpos($post->post_content, "[pmpro_" . $pmpro_page_name . "]") !== false) 
  12. //preheader 
  13. require_once(PMPRO_DIR . "/preheaders/" . $pmpro_page_name . ".php"); 
  14.  
  15. //add class to body 
  16. $pmpro_body_classes[] = "pmpro-" . str_replace("_", "-", $pmpro_page_name); 
  17.  
  18. //shortcode 
  19. function pmpro_pages_shortcode($atts, $content=null, $code="") 
  20. global $pmpro_page_name; 
  21. $temp_content = pmpro_loadTemplate($pmpro_page_name, 'local', 'pages'); 
  22.  
  23. /** 
  24. ob_start(); 
  25.   
  26. if(file_exists(get_stylesheet_directory() . "/paid-memberships-pro/pages/" . $pmpro_page_name . ".php")) 
  27. include(get_stylesheet_directory() . "/paid-memberships-pro/pages/" . $pmpro_page_name . ".php"); 
  28. elseif(file_exists(get_template_directory() . "/paid-memberships-pro/pages/" . $pmpro_page_name . ".php")) 
  29. include(get_template_directory() . "/paid-memberships-pro/pages/" . $pmpro_page_name . ".php"); 
  30. else 
  31. include(PMPRO_DIR . "/pages/" . $pmpro_page_name . ".php"); 
  32.   
  33. $temp_content = ob_get_contents(); 
  34. // ob_end_clean(); 
  35. */ 
  36. return apply_filters("pmpro_pages_shortcode_" . $pmpro_page_name, $temp_content); 
  37. add_shortcode("pmpro_" . $pmpro_page_name, "pmpro_pages_shortcode"); 
  38. break; //only the first page found gets a shortcode replacement 
  39. elseif(!empty($pmpro_page_id) && is_page($pmpro_page_id)) 
  40. //shortcode has params, but we still want to load the preheader 
  41. require_once(PMPRO_DIR . "/preheaders/" . $pmpro_page_name . ".php"); 
  42. }