bp_activity_embed_add_inline_styles()

Add inline styles for BP activity embeds.

Description

Source

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

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.