<?php
/**
 * Plugin Name: LH Buddypress Add to Sitemap
 * Plugin URI: https://lhero.org/portfolio/lh-buddypress-add-to-sitemap/
 * Description: Add buddypress objects to the wp sitemap
 * Version: 1.00
 * Author: Peter Shaw
 * Author URI: http://shawfactor.com/
 * Tags: Meta, html, head
 * Text Domain: lh_bats
 * Domain Path: /languages
*/




 if (!class_exists('LH_Buddypress_add_to_sitemap_plugin')) {

class  LH_Buddypress_add_to_sitemap_plugin {
    
    private static $instance;
    
   static function return_plugin_namespace(){

    return 'lh_bats';

    } 
    
    


    
    
public function init_plugin(){
        
        

            
            
            
add_action('init', function() {
    
if (!is_admin()){
    
if (!class_exists('LH_Buddpress_sitemap_extender_class')) {
    
    include_once("includes/lh-buddypress-add-to-sitemap-class.php");
    
}
    
  $rangeProvider = new LH_Buddpress_sitemap_extender_class();
  wp_register_sitemap_provider('groups', $rangeProvider);
  
 }
            
            
        });
        
        
        

        
}
    
    
          /**
     * Gets an instance of our plugin.
     *
     * using the singleton pattern
     */
    public static function get_instance(){
        if (null === self::$instance) {
            self::$instance = new self();
        }
 
        return self::$instance;
    }

    
    public	function __construct() {

               // Check for BuddyPress and initialize if it is active
               add_action( 'bp_include', array( $this, 'init_plugin' ) );
        

       
        
        
    }
    
    
    
    
}

$lh_buddypress_add_to_sitemap = LH_Buddypress_add_to_sitemap_plugin::get_instance();


}


?>