Changeset 7452 for trunk/bp-core/bp-core-template-loader.php
- Timestamp:
- 10/22/2013 01:55:08 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-template-loader.php
r7432 r7452 2 2 3 3 /** 4 * BuddyPress Template Functions 4 * BuddyPress Template Functions. 5 5 * 6 6 * This file contains functions necessary to mirror the WordPress core template … … 16 16 17 17 /** 18 * Adds BuddyPress theme support to any active WordPress theme 19 * 20 * @since BuddyPress (1.7) 21 * 22 * @param string $slug 23 * @param string $name Optional. Default null 18 * Get a BuddyPress template part for display in a theme. 19 * 20 * @since BuddyPress (1.7.0) 21 * 24 22 * @uses bp_locate_template() 25 23 * @uses load_template() 26 24 * @uses get_template_part() 25 * 26 * @param string $slug Template part slug. Used to generate filenames, eg 27 * 'friends' for 'friends.php'. 28 * @param string $name Optional. Template part name. Used to generate 29 * secondary filenames, eg 'personal' for 'activity-personal.php'. 30 * @return string Path to located template. See {@link bp_locate_template()}. 27 31 */ 28 32 function bp_get_template_part( $slug, $name = null ) { … … 51 55 * not found in either of those, it looks in the theme-compat folder last. 52 56 * 53 * @since BuddyPress (1.7 )57 * @since BuddyPress (1.7.0) 54 58 * 55 59 * @param string|array $template_names Template file(s) to search for, in order. 56 * @param bool $load If true the template file will be loaded if it is found. 57 * @param bool $require_once Whether to require_once or require. Default true. 58 * Has no effect if $load is false. 60 * @param bool $load Optional. If true, the template file will be loaded when 61 * found. If false, the path will be returned. Default: false. 62 * @param bool $require_once Optional. Whether to require_once or require. Has 63 * no effect if $load is false. Default: true. 59 64 * @return string The template filename if one is located. 60 65 */ … … 98 103 99 104 /** 100 * This is really cool. This function registers a new template stack location, 101 * using WordPress's built in filters API. 105 * Register a new template stack location. 102 106 * 103 107 * This allows for templates to live in places beyond just the parent/child … … 105 109 * with bp_locate_template(), this allows for easy template overrides. 106 110 * 107 * @since BuddyPress (1.7) 108 * 109 * @param string $location Callback function that returns the stack location 110 * @param int $priority 111 * @since BuddyPress (1.7.0) 112 * 113 * @todo Make 'callable' instead of 'function'. 114 * 115 * @param string $location Callback function that returns the stack location. 116 * @param int $priority Optional. The priority parameter as passed to 117 * add_filter(). Default: 10. 118 * @return bool See {@link add_filter()}. 111 119 */ 112 120 function bp_register_template_stack( $location_callback = '', $priority = 10 ) { … … 121 129 122 130 /** 123 * Deregisters a previously registered template stack location. 124 * 125 * @since BuddyPress (1.7) 126 * 127 * @param string $location Callback function that returns the stack location 128 * @param int $priority 131 * Deregister a previously registered template stack location. 132 * 133 * @since BuddyPress (1.7.0) 134 * 129 135 * @see bp_register_template_stack() 136 * 137 * @param string $location Callback function that returns the stack location. 138 * @param int $priority Optional. The priority parameter passed to 139 * {@link bp_register_template_stack()}. Default: 10. 140 * @return bool See {@link remove_filter()}. 130 141 */ 131 142 function bp_deregister_template_stack( $location_callback = '', $priority = 10 ) { … … 140 151 141 152 /** 142 * Call the functions added to the 'bp_template_stack' filter hook, and return 153 * Get the "template stack", a list of registered directories where templates can be found. 154 * 155 * Calls the functions added to the 'bp_template_stack' filter hook, and return 143 156 * an array of the template locations. 144 157 * 145 158 * @see bp_register_template_stack() 146 159 * 147 * @since BuddyPress (1.7 )148 * 149 * @global array $wp_filter Stores all of the filters 150 * @global array $merged_filters Merges the filter hooks using this function. 151 * @global array $wp_current_filter stores the list of current filters with the current one last152 * 160 * @since BuddyPress (1.7.0) 161 * 162 * @global array $wp_filter Stores all of the filters. 163 * @global array $merged_filters Merges the filter hooks using this function.. 164 * @global array $wp_current_filter stores the list of current filters with 165 * the current one last. 153 166 * @return array The filtered value after all hooked functions are applied to it. 154 167 */ … … 192 205 193 206 /** 194 * Get a template part in an output buffer, and return it 195 * 196 * @since BuddyPress (1.7) 197 * 198 * @param string $slug 199 * @param string $name 200 * @return string 207 * Put a template part into an output buffer, and return it. 208 * 209 * @since BuddyPress (1.7.0) 210 * 211 * @see bp_get_template_part() for a description of $slug and $name params. 212 * 213 * @param string $slug See {@link bp_get_template_part()}. 214 * @param string $name See {@link bp_get_template_part()}. 215 * @param bool $echo If true, template content will be echoed. If false, 216 * returned. Default: true. 217 * @return string|null If $echo, returns the template content. 201 218 */ 202 219 function bp_buffer_template_part( $slug, $name = null, $echo = true ) { … … 223 240 224 241 /** 225 * Retrieve path to a template242 * Retrieve the path to a template. 226 243 * 227 244 * Used to quickly retrieve the path of a template without including the file … … 230 247 * locations without the use of the other get_*_template() functions. 231 248 * 232 * @since BuddyPress (1.7) 233 * 234 * @param string $type Filename without extension. 235 * @param array $templates An optional list of template candidates 249 * @since BuddyPress (1.7.0) 250 * 236 251 * @uses bp_set_theme_compat_templates() 237 252 * @uses bp_locate_template() 238 253 * @uses bp_set_theme_compat_template() 254 * 255 * @param string $type Filename without extension. 256 * @param array $templates An optional list of template candidates. 239 257 * @return string Full path to file. 240 258 */ … … 272 290 273 291 /** 274 * Add template locations to template files being searched for 275 * 276 * @since BuddyPress (1.7 )277 * 278 * @param array $stacks 279 * @return array() 292 * Add template locations to template files being searched for. 293 * 294 * @since BuddyPress (1.7.0) 295 * 296 * @param array $stacks Array of template locations. 297 * @return array() Array of all template locations registered so far. 280 298 */ 281 299 function bp_add_template_stack_locations( $stacks = array() ) { … … 294 312 295 313 /** 296 * Add checks for BuddyPress conditions to parse_query action297 * 298 * @since BuddyPress (1.7 )314 * Add checks for BuddyPress conditions to 'parse_query' action. 315 * 316 * @since BuddyPress (1.7.0) 299 317 * 300 318 * @param WP_Query $posts_query … … 319 337 320 338 /** 321 * Possibly intercept the template being loaded 339 * Possibly intercept the template being loaded. 322 340 * 323 341 * Listens to the 'template_include' filter and waits for any BuddyPress specific … … 328 346 * from being stomped on accident. 329 347 * 330 * @since BuddyPress (1.7 )348 * @since BuddyPress (1.7.0) 331 349 * 332 350 * @param string $template 333 * 334 * @return string The path to the template file that is being used 351 * @return string The path to the template file that is being used. 335 352 */ 336 353 function bp_template_include_theme_supports( $template = '' ) { … … 349 366 350 367 /** 351 * Set the included template 352 * 353 * @since BuddyPress (1.8) 354 * @param mixed $template Default false 355 * @return mixed False if empty. Template name if template included 368 * Set the included template. 369 * 370 * @since BuddyPress (1.8.0) 371 * 372 * @param mixed $template Default: false. 373 * @return mixed False if empty. Template name if template included. 356 374 */ 357 375 function bp_set_template_included( $template = false ) { … … 364 382 * Is a BuddyPress template being included? 365 383 * 366 * @since BuddyPress (1.8 )367 * @return bool True if yes, false if no 384 * @since BuddyPress (1.8.0) 385 * @return bool True if yes, false if no. 368 386 */ 369 387 function bp_is_template_included() { … … 372 390 373 391 /** 374 * Attempt to load a custom BuddyPress functions file, similar to each themes 375 * functions.php file. 376 * 377 * @since BuddyPress (1.7) 392 * Attempt to load a custom BP functions file, similar to each themes functions.php file. 393 * 394 * @since BuddyPress (1.7.0) 378 395 * 379 396 * @global string $pagenow … … 399 416 400 417 /** 401 * Get the templates to use as the endpoint for BuddyPress template parts 402 * 403 * @since BuddyPress (1.7) 404 * 405 * @uses apply_filters() 406 * @return array Of possible root level wrapper template files 418 * Get the templates to use as the endpoint for BuddyPress template parts. 419 * 420 * @since BuddyPress (1.7.0) 421 * 422 * @return array Array of possible root level wrapper template files. 407 423 */ 408 424 function bp_get_theme_compat_templates() {
Note: See TracChangeset
for help on using the changeset viewer.