Skip to:
Content

BuddyPress.org

Ticket #8349: lh-buddypress-add-to-sitemap.php

File lh-buddypress-add-to-sitemap.php, 1.7 KB (added by shawfactor, 6 years ago)
Line 
1<?php
2/**
3 * Plugin Name: LH Buddypress Add to Sitemap
4 * Plugin URI: https://lhero.org/portfolio/lh-buddypress-add-to-sitemap/
5 * Description: Add buddypress objects to the wp sitemap
6 * Version: 1.00
7 * Author: Peter Shaw
8 * Author URI: http://shawfactor.com/
9 * Tags: Meta, html, head
10 * Text Domain: lh_bats
11 * Domain Path: /languages
12*/
13
14
15
16
17 if (!class_exists('LH_Buddypress_add_to_sitemap_plugin')) {
18
19class LH_Buddypress_add_to_sitemap_plugin {
20
21 private static $instance;
22
23 static function return_plugin_namespace(){
24
25 return 'lh_bats';
26
27 }
28
29
30
31
32
33
34public function init_plugin(){
35
36
37
38
39
40
41add_action('init', function() {
42
43if (!is_admin()){
44
45if (!class_exists('LH_Buddpress_sitemap_extender_class')) {
46
47 include_once("includes/lh-buddypress-add-to-sitemap-class.php");
48
49}
50
51 $rangeProvider = new LH_Buddpress_sitemap_extender_class();
52 wp_register_sitemap_provider('groups', $rangeProvider);
53
54 }
55
56
57 });
58
59
60
61
62
63}
64
65
66 /**
67 * Gets an instance of our plugin.
68 *
69 * using the singleton pattern
70 */
71 public static function get_instance(){
72 if (null === self::$instance) {
73 self::$instance = new self();
74 }
75
76 return self::$instance;
77 }
78
79
80 public function __construct() {
81
82 // Check for BuddyPress and initialize if it is active
83 add_action( 'bp_include', array( $this, 'init_plugin' ) );
84
85
86
87
88
89 }
90
91
92
93
94}
95
96$lh_buddypress_add_to_sitemap = LH_Buddypress_add_to_sitemap_plugin::get_instance();
97
98
99}
100
101
102?>