bp_activity_embed_add_inline_styles()

Add inline styles for BP activity embeds.

Description

Source

File: bp-activity/bp-activity-embeds.php

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
function bp_activity_embed_add_inline_styles() {
    if ( false === bp_is_single_activity() ) {
        return;
    }
 
    $min = bp_core_get_minified_asset_suffix();
 
    if ( is_rtl() ) {
        $css = bp_locate_template_asset( "css/embeds-activity-rtl{$min}.css" );
    } else {
        $css = bp_locate_template_asset( "css/embeds-activity{$min}.css" );
    }
 
    // Bail if file wasn't found.
    if ( false === $css ) {
        return;
    }
 
    // Grab contents of CSS file and do some rudimentary CSS protection.
    $css = file_get_contents( $css['file'] );
    $css = wp_kses( $css, array( "\'", '\"' ) );
 
    printf( '<style>%s</style>', $css );
}

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.