bp_attachments_get_template_part

Get an Attachment template part.

Description

bp_attachments_get_template_part( (string) $slug ); 

Parameters (1)

0. $slug (string)
Template part slug. eg uploader for uploader.php..

Usage

  1. if ( !function_exists( 'bp_attachments_get_template_part' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-attachments.php'; 
  3.  
  4. // Template part slug. eg 'uploader' for 'uploader.php'. 
  5. $slug = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_attachments_get_template_part($slug); 
  9.  

Defined (1)

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

/bp-core/bp-core-attachments.php  
  1. function bp_attachments_get_template_part( $slug ) { 
  2. $attachment_template_part = 'assets/_attachments/' . $slug; 
  3.  
  4. // Load the attachment template in WP Administration screens. 
  5. if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { 
  6. $attachment_admin_template_part =buddypress)->themes_dir . '/bp-legacy/buddypress/' . $attachment_template_part . '.php'; 
  7.  
  8. // Check whether the template part exists. 
  9. if ( ! file_exists( $attachment_admin_template_part ) ) { 
  10. return false; 
  11.  
  12. // Load the template part. 
  13. require( $attachment_admin_template_part ); 
  14.  
  15. // Load the attachment template in WP_USE_THEMES env. 
  16. } else { 
  17. bp_get_template_part( $attachment_template_part );