bp_attachments_get_template_part( string $slug )

Get an Attachment template part.

Description

Parameters

$slug

(Required) Template part slug. eg 'uploader' for 'uploader.php'.

Return

(bool)

Source

File: bp-core/bp-core-attachments.php

1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
function bp_attachments_get_template_part( $slug ) {
    $switched = false;
 
    /*
     * Use bp-legacy attachment template part for older bp-default themes or if in
     * admin area.
     */
    if ( ! bp_use_theme_compat_with_current_theme() || ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) ) {
        $current = bp_get_theme_compat_id();
        if ( 'legacy' !== $current ) {
            $switched = true;
            bp_setup_theme_compat( 'legacy' );
        }
    }
 
    // Load the template part.
    bp_get_template_part( 'assets/_attachments/' . $slug );
 
    if ( $switched ) {
        bp_setup_theme_compat( $current );
    }
}

Changelog

Changelog
Version Description
BuddyPress 2.3.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.