wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_enqueue_block_support_styles › WordPress Function

Depuis5.9.1
Dépréciéen/a
wp_enqueue_block_support_styles ( $style, $priority = 10 )
Paramètres: (2)
  • (string) $style String containing the CSS styles to be added.
    Requis: Oui
  • (int) $priority To set the priority for the add_action.
    Requis: Non
    Défaut: 10
Liens:
Défini(e) dans:
Codex:
Changelog:
  • 6.1.0

Hooks inline styles in the proper place, depending on the active theme.



Source

function wp_enqueue_block_support_styles( $style, $priority = 10 ) {
	$action_hook_name = 'wp_footer';
	if ( wp_is_block_theme() ) {
		$action_hook_name = 'wp_head';
	}
	add_action(
		$action_hook_name,
		static function () use ( $style ) {
			echo "<style>$style</style>\n";
		},
		$priority
	);
}