File: /home/globfdxw/diasporameetsafrica.com/wp-content/plugins/lavelo-core/kc/shortcodes/title/title.php
<?php
/* ==========================================================
Title Info
=========================================================== */
if ( !function_exists('lavelo_title_shortcode_function')) {
function lavelo_title_shortcode_function( $atts, $content = true ) {
extract($atts);
$uniqid = uniqid( '-', false);
$inline_style = '';
if ( $title_color || $title_size ) {
$inline_style .= '.lavelo-title'.$uniqid.'.lavelo-title h2 {';
$inline_style .= $title_color ? 'color: '.$title_color.'; ' : '';
$inline_style .= $title_size ? 'font-size: '.$title_size.'; ' : '';
$inline_style .= '}';
}
$image_url = wp_get_attachment_url( $title_bg );
if ( $image_url ) {
$inline_style .= '.lavelo-title'.$uniqid.'.lavelo-title h2:after, .lavelo-title'.$uniqid.'.section-title h2:before {';
$inline_style .= $image_url ? 'background: url( '.$image_url.' ) no-repeat center center / cover; ' : '';
$inline_style .= '}';
}
$image_url_2 = wp_get_attachment_url( $title_bg_2 );
if ( $image_url_2 ) {
$inline_style .= '.lavelo-title'.$uniqid.'.section-title h2:after {';
$inline_style .= $image_url_2 ? 'background: url( '.$image_url_2.' ) no-repeat center center / cover; ' : '';
$inline_style .= '}';
}
// integrate css
add_inline_style( $inline_style );
$inline_class = ' lavelo-title'.$uniqid;
if ( $title_style == 'classic' ) {
$title_class = ' lavelo-title';
} else {
$title_class = ' section-title';
}
ob_start(); ?>
<div class="text-center <?php echo esc_attr( $class.$inline_class.$title_class ); ?>">
<h2><?php echo esc_html( $title ); ?></h2>
</div>
<?php return ob_get_clean();
}
}
add_shortcode( 'section_title', 'lavelo_title_shortcode_function' );