Skip to content

Commit

Permalink
dealing with fontawesome
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariel Jolo committed Feb 18, 2025
1 parent 1e60c1e commit 43132a2
Showing 1 changed file with 1 addition and 53 deletions.
54 changes: 1 addition & 53 deletions themes/osi/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -549,56 +549,4 @@ function osi_handle_supporter_form_flamingo_spam_status_change( string $new_stat
}
}
}
add_action( 'transition_post_status', 'osi_handle_supporter_form_flamingo_spam_status_change', 10, 3 );

/**
* Allow Font Awesome icons in Gutenberg blocks
*/
function allow_font_awesome_icons($allowed_html) {
// If the allowed_html array doesn't exist, create it
if (!is_array($allowed_html)) {
$allowed_html = array();
}

// Add specific Font Awesome support
$allowed_html['i'] = array(
'class' => true,
'style' => true,
'aria-hidden' => true,
);

// Add support for div containers
$allowed_html['div'] = array(
'class' => true,
'style' => true,
);

return $allowed_html;
}
add_filter('wp_kses_allowed_html', 'allow_font_awesome_icons', 99, 1);

/**
* Allow Font Awesome classes in Gutenberg blocks
*/
function allow_fa_classes_in_blocks($block_content, $block) {
// Remove wp_kses filtering for blocks that might contain Font Awesome icons
if (isset($block['blockName']) && (
strpos($block['blockName'], 'core/html') !== false ||
strpos($block['blockName'], 'core/paragraph') !== false ||
strpos($block['blockName'], 'core/group') !== false
)) {
remove_filter('the_content', 'wp_kses_post');
}

return $block_content;
}
add_filter('render_block', 'allow_fa_classes_in_blocks', 10, 2);

/**
* Add Font Awesome to allowed protocols
*/
function add_fa_to_allowed_protocols($protocols) {
$protocols[] = 'data-fa';
return $protocols;
}
add_filter('kses_allowed_protocols', 'add_fa_to_allowed_protocols');
add_action( 'transition_post_status', 'osi_handle_supporter_form_flamingo_spam_status_change', 10, 3 );

0 comments on commit 43132a2

Please sign in to comment.