bp_ajax_querystring

Allow templates to pass parameters directly into the template loops via AJAX.

Description

(string) bp_ajax_querystring( (bool) $object = false ); 

For the most part this will be filtered in a theme's functions.php for example in the default theme it is filtered via bp_dtheme_ajax_querystring().

By using this template tag in the templates it will stop them from showing errors if someone copies the templates from the default theme into another WordPress theme without coping the functions from functions.php.

Returns (string)

The AJAX querystring.

Parameters (1)

0. $object — Optional. (bool) => false
Current template component.

Usage

  1. if ( !function_exists( 'bp_ajax_querystring' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-template.php'; 
  3.  
  4. // Current template component. 
  5. $object = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_ajax_querystring($object); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-template.php  
  1. function bp_ajax_querystring( $object = false ) { 
  2. $bp =buddypress); 
  3.  
  4. if ( ! isset( $bp->ajax_querystring ) ) { 
  5. $bp->ajax_querystring = ''; 
  6.  
  7. /** 
  8. * Filters the template paramenters to be used in the query string. 
  9. * Allows templates to pass parameters into the template loops via AJAX. 
  10. * @since 1.2.0 
  11. * @param string $ajax_querystring Current query string. 
  12. * @param string $object Current template component. 
  13. */ 
  14. return apply_filters( 'bp_ajax_querystring', $bp->ajax_querystring, $object );