Hi Support-Team,
i was wondering how i can modify the alert shortcode in a way that the heading is not a “h6” heading but a “h3” heading or maybe just a “div”. My idea was to put this code in my child`s theme function,php:
// Alert
// =============================================================================
function x_shortcode_alert2( $atts, $content = null ) {
extract( shortcode_atts( array(
'id' => '',
'class' => '',
'style' => '',
'type' => '',
'heading' => '',
'close' => ''
), $atts, 'x_alert' ) );
$id = ( $id != '' ) ? 'id="' . esc_attr( $id ) . '"' : '';
$class = ( $class != '' ) ? 'x-alert ' . esc_attr( $class ) : 'x-alert';
$style = ( $style != '' ) ? 'style="' . $style . '"' : '';
$type = ( $type != '' ) ? ' x-alert-' . $type : '';
$heading = ( $heading != '' ) ? $heading = '<h3 class="h-alert">' . $heading . '</h3>' : $heading = '';
if ( $close == 'true' ) {
$close = ' fade in';
$close_btn = '<button type="button" class="close" data-dismiss="alert">×</button>';
} else {
$close = ' x-alert-block';
$close_btn = '';
}
$output = "<div {$id} class=\"{$class}{$type}{$close}\" {$style}>{$close_btn}{$heading}" . do_shortcode( $content ) . "</div>";
return $output;
}
add_filter('init', function() {
remove_shortcode( 'x_shortcode_alert' );
add_shortcode( 'x_alert', 'x_shortcode_alert2' );
});
But somehow it doesn`t work. Do you have a clue or another way to solve this?
Many Thanks