[ Index ]

PHP Cross Reference of BBPress

title

Body

[close]

/src/includes/core/ -> template-functions.php (summary)

bbPress Template Functions This file contains functions necessary to mirror the WordPress core template loading process. Many of those functions are not filterable, and even then would not be robust enough to predict where bbPress templates might exist.

File Size: 737 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 14 functions

  bbp_get_template_part()
  bbp_locate_template()
  bbp_locate_enqueueable()
  bbp_urlize_enqueueable()
  bbp_enqueue_style()
  bbp_enqueue_script()
  bbp_register_template_stack()
  bbp_deregister_template_stack()
  bbp_get_template_stack()
  bbp_buffer_template_part()
  bbp_get_query_template()
  bbp_get_template_locations()
  bbp_add_template_stack_locations()
  bbp_parse_query()

Functions
Functions that are not part of a class:

bbp_get_template_part( $slug, $name = null )   X-Ref
Adds bbPress theme support to any active WordPress theme

param: string $slug
param: string $name Optional. Default null
since: 2.0.0 bbPress (r3032)

bbp_locate_template( $template_names, $load = false, $require_once = true )   X-Ref
Retrieve the name of the highest priority template file that exists.

Searches in the child theme before parent theme so that themes which
inherit from a parent theme can just overload one file. If the template is
not found in either of those, it looks in the theme-compat folder last.

param: string|array $template_names Template file(s) to search for, in order.
param: bool $load If true the template file will be loaded if it is found.
param: bool $require_once Whether to require_once or require. Default true.
return: string The template filename if one is located.
since: 2.1.0 bbPress (r3618)

bbp_locate_enqueueable( $file = '' )   X-Ref
Locate an enqueueable file on the server. Used before being enqueued.

If SCRIPT_DEBUG is set and the file includes a .min suffix, this function
will automatically attempt to locate a non-minified version of that file.

If SCRIPT_DEBUG is not set and the file exclude a .min suffix, this function
will automatically attempt to locate a minified version of that file.

See: https://bbpress.trac.wordpress.org/ticket/3218

param: string $file
return: boolean
since: 2.6.0

bbp_urlize_enqueueable( $file = '' )   X-Ref
Convert an enqueueable file path to a URL

param: string $file
return: string
since: 2.6.0

bbp_enqueue_style( $handle = '', $file = '', $deps = array()   X-Ref
Enqueue a script from the highest priority location in the template stack.

Registers the style if file provided (does NOT overwrite) and enqueues.

param: string      $handle Name of the stylesheet.
param: string|bool $file   Relative path to stylesheet. Example: '/css/mystyle.css'.
param: array       $deps   An array of registered style handles this stylesheet depends on. Default empty array.
param: string|bool $ver    String specifying the stylesheet version number, if it has one. This parameter is used
param: string      $media  Optional. The media for which this stylesheet has been defined.
return: mixed The style filename if one is located. False if not.
since: 2.5.0 bbPress (r5180)

bbp_enqueue_script( $handle = '', $file = '', $deps = array()   X-Ref
Enqueue a script from the highest priority location in the template stack.

Registers the style if file provided (does NOT overwrite) and enqueues.

param: string      $handle    Name of the script.
param: string|bool $file      Relative path to the script. Example: '/js/myscript.js'.
param: array       $deps      An array of registered handles this script depends on. Default empty array.
param: string|bool $ver       Optional. String specifying the script version number, if it has one. This parameter
param: bool        $in_footer Optional. Whether to enqueue the script before </head> or before </body>.
return: mixed The script filename if one is located. False if not.
since: 2.5.0 bbPress (r5180)

bbp_register_template_stack( $location_callback = '', $priority = 10 )   X-Ref
This is really cool. This function registers a new template stack location,
using WordPress's built in filters API.

This allows for templates to live in places beyond just the parent/child
relationship, to allow for custom template locations. Used in conjunction
with bbp_locate_template(), this allows for easy template overrides.

param: string $location_callback Callback function that returns the
param: int $priority
since: 2.2.0 bbPress (r4323)

bbp_deregister_template_stack( $location_callback = '', $priority = 10 )   X-Ref
Deregisters a previously registered template stack location.

param: string $location_callback Callback function that returns the
param: int $priority
return: bool Whether stack was removed
since: 2.3.0 bbPress (r4652)

bbp_get_template_stack()   X-Ref
Call the functions added to the 'bbp_template_stack' filter hook, and return
an array of the template locations.

return: array The filtered value after all hooked functions are applied to it.
since: 2.2.0 bbPress (r4323)
since: 2.6.0 bbPress (r5944) Added support for `WP_Hook`

bbp_buffer_template_part( $slug, $name = null, $echo = true )   X-Ref
Get a template part in an output buffer, and return it

param: string $slug
param: string $name
return: string
since: 2.4.0 bbPress (r5043)

bbp_get_query_template( $type, $templates = array()   X-Ref
Retrieve path to a template

Used to quickly retrieve the path of a template without including the file
extension. It will also check the parent theme and theme-compat theme with
the use of {@link bbp_locate_template()}. Allows for more generic template
locations without the use of the other get_*_template() functions.

param: string $type Filename without extension.
param: array $templates An optional list of template candidates
return: string Full path to file.
since: 2.1.0 bbPress (r3629)

bbp_get_template_locations( $templates = array()   X-Ref
Get the possible subdirectories to check for templates in

param: array $templates Templates we are looking for
return: array Possible subdirectories to look in
since: 2.1.0 bbPress (r3738)

bbp_add_template_stack_locations( $stacks = array()   X-Ref
Add template locations to template files being searched for

param: array $stacks
return: array()
since: 2.1.0 bbPress (r3738)

bbp_parse_query( $posts_query )   X-Ref
Add checks for bbPress conditions to parse_query action

If it's a user page, WP_Query::bbp_is_single_user is set to true.

If it's a user edit page, WP_Query::bbp_is_single_user_edit is set to true
and the the 'wp-admin/includes/user.php' file is included.

In addition, on user/user edit pages, WP_Query::home is set to false & query
vars 'bbp_user_id' with the displayed user id is added.

In 2.6.0, the 'author_name' variable is no longer set when viewing a single
user, because of is_author() weirdness. If this removal causes problems, it
may come back in a future release.

If it's a forum edit, WP_Query::bbp_is_forum_edit is set to true
If it's a topic edit, WP_Query::bbp_is_topic_edit is set to true
If it's a reply edit, WP_Query::bbp_is_reply_edit is set to true.

If it's a view page, WP_Query::bbp_is_view is set to true
If it's a search page, WP_Query::bbp_is_search is set to true

param: WP_Query $posts_query
since: 2.0.0 bbPress (r2688)



Generated: Wed Dec 11 01:01:26 2019 Cross-referenced by PHPXref 0.7.1