1 | <?php |
||
21 | class Custom_Sidebars { |
||
|
|||
22 | |||
23 | /** |
||
24 | * @var Custom_Sidebars_Details |
||
25 | */ |
||
26 | private $custom_sidebar_details; |
||
27 | |||
28 | /** |
||
29 | * The default sidebar id |
||
30 | * |
||
31 | * @var string |
||
32 | * @access private |
||
33 | * @static |
||
34 | */ |
||
35 | private static $default_sidebar_id; |
||
36 | |||
37 | /** |
||
38 | * The class constructor |
||
39 | */ |
||
40 | public function __construct() { |
||
47 | |||
48 | /** |
||
49 | * Instantiate the custom sidebars metabox class |
||
50 | * |
||
51 | * This method is hooked to the WP admin_init action |
||
52 | */ |
||
53 | public function admin_init() { |
||
58 | |||
59 | /** |
||
60 | * The WP admin_init action callback |
||
61 | * |
||
62 | * Get all pages and posts and add sidebars for each individual post |
||
63 | */ |
||
64 | public function init() { |
||
104 | |||
105 | /** |
||
106 | * Get the sidebar id for a specific post |
||
107 | * |
||
108 | * @param int|null The WP post id |
||
109 | * @return string The sidebar id |
||
110 | */ |
||
111 | public function get_sidebar_id( $post_id = null ) { |
||
118 | |||
119 | /** |
||
120 | * Get the post types for which custom sidebars should be registered |
||
121 | */ |
||
122 | public static function get_post_types() { |
||
127 | |||
128 | /** |
||
129 | * Get the sidebar_id assigned to a specific post |
||
130 | */ |
||
131 | public static function get_sidebar( $post_id = null ) { |
||
146 | |||
147 | /** |
||
148 | * Register a default sidebar to use when a post has no specific sidebar assigned |
||
149 | */ |
||
150 | public static function register_default_sidebar( $sidebar_id ) { |
||
155 | |||
156 | /** |
||
157 | * Filter the sidebar widgets |
||
158 | * |
||
159 | * This method is hooked to the WP filter sidebars_widgets. |
||
160 | * |
||
161 | * Since we have no way to know what sidebar is currently being called, this method |
||
162 | * replaces the array of widgets for ALL registered sidebars with the widgets |
||
163 | * assigned to the sidebar specified for use on this particular post/page. This is a |
||
164 | * carpet-bomb approach that should be more specific, but current limitiations in the |
||
165 | * WP infrastructure require it to be done this way. |
||
166 | * |
||
167 | * @param array $sidebar_widgets |
||
168 | * @return array $sidebar_widgets The filtered widget array |
||
169 | * @since 0.3 |
||
170 | */ |
||
171 | public function sidebars_widgets( $sidebar_widgets ) { |
||
182 | |||
183 | } |
||
184 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.