post_id ) ) {
$wp_image = wp_get_attachment_image_src( get_post_thumbnail_id( $us_layout->post_id ), 'full' );
if ( $wp_image ) {
$bg_image_url = $wp_image[0];
$bg_img_atts .= ' data-img-width="' . esc_attr( $wp_image[1] ) . '" data-img-height="' . esc_attr( $wp_image[2] ) . '"';
}
}
}
if ( ! empty( $bg_image_url ) ) {
$classes .= ' with_img';
$bg_image_inline_css = 'background-image: url(' . $bg_image_url . ');';
if ( $us_bg_pos != 'center center' ) {
$bg_image_inline_css .= 'background-position: ' . $us_bg_pos . ';';
}
if ( $us_bg_repeat != 'repeat' ) {
$bg_image_inline_css .= 'background-repeat: ' . $us_bg_repeat . ';';
}
if ( $us_bg_size != 'cover' ) {
$bg_image_inline_css .= 'background-size: ' . $us_bg_size . ';';
}
$bg_image_additional_class = ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) ? ' loaded' : '';
$bg_image_html = '
';
}
// Background Video
$bg_video_html = '';
if ( $us_bg_video != '' ) {
$classes .= ' with_video';
$provider_matched = FALSE;
$bg_video_html = '';
foreach ( us_config( 'embeds' ) as $provider => $embed ) {
if ( $embed['type'] != 'video' OR ! preg_match( $embed['regex'], $us_bg_video, $matches ) ) {
continue;
}
$provider_matched = TRUE;
$video_id = $matches[ $embed['match_index'] ];
if ( $provider == 'youtube' ) {
$classes .= ' with_youtube';
$video_title = '?autoplay=1&loop=1&playlist=' . $video_id . '&showinfo=0&controls=0&rel=0&showinfo=0&mute=1&iv_load_policy=3&disablekb=1&wmode=transparent';
} elseif ( $provider == 'vimeo' ) {
$classes .= ' with_vimeo';
$video_title = '&autoplay=1&loop=1&muted=1&title=0&byline=0&background=1';
}
$embed_html = str_replace( '', $matches[ $embed['match_index'] ], $embed['html'] );
$embed_html = str_replace( '', $video_title, $embed_html );
break;
}
if ( $provider_matched ) {
$bg_video_html .= $embed_html;
} else {
$bg_video_html .= '';
}
$bg_video_html .= '
';
} else {
if ( $us_bg_parallax == 'vertical' ) {
$classes .= ' parallax_ver';
if ( $us_bg_parallax_reverse ) {
$classes .= ' parallaxdir_reversed';
}
if ( in_array( $us_bg_pos, array( 'top right', 'center right', 'bottom right' ) ) ) {
$classes .= ' parallax_xpos_right';
} elseif ( in_array( $us_bg_pos, array( 'top left', 'center left', 'bottom left' ) ) ) {
$classes .= ' parallax_xpos_left';
}
} elseif ( $us_bg_parallax == 'fixed' OR $us_bg_parallax == 'still' ) {
$classes .= ' parallax_fixed';
} elseif ( $us_bg_parallax == 'horizontal' ) {
$classes .= ' parallax_hor';
$classes .= ' bgwidth_' . $us_bg_parallax_width;
}
}
// Background Slider
$bg_slider_html = '';
if ( class_exists( 'RevSlider' ) AND $us_bg_slider != '' ) {
$classes .= ' with_slider';
$bg_slider_html = '' . do_shortcode( '[rev_slider ' . $us_bg_slider . ']' ) . '
';
}
// Background Overlay
$bg_overlay_html = '';
if ( ! empty( $us_bg_overlay_color ) ) {
$classes .= ' with_overlay';
$bg_overlay_html = '';
}
// We cannot use VC's method directly for rows: as it uses !important values, so we're moving the defined css
// that don't duplicate the theme's features to inline style attribute.
if ( ! empty( $css ) AND preg_match( '~\{([^\}]+?)\;?\}~', $css, $matches ) ) {
$vc_css_rules = array_map( 'trim', explode( ';', $matches[1] ) );
$overloaded_params = array(
'background',
'background-position',
'background-repeat',
'background-size',
'padding-top',
'padding-bottom',
);
$inner_params = array(
'padding-top',
'padding-bottom',
);
foreach ( $vc_css_rules as $vc_css_rule ) {
$vc_css_rule = explode( ':', $vc_css_rule );
// Generate inline styles for "l-section"
if ( count( $vc_css_rule ) == 2 AND ! in_array( $vc_css_rule[0], $overloaded_params ) ) {
$inline_css .= $vc_css_rule[0] . ':' . $vc_css_rule[1] . ';';
}
// Generate inline styles for "l-section-h"
if ( count( $vc_css_rule ) == 2 AND in_array( $vc_css_rule[0], $inner_params ) ) {
$inner_inline_css .= $vc_css_rule[0] . ':' . $vc_css_rule[1] . ';';
}
}
}
$classes = apply_filters( 'vc_shortcodes_css_class', $classes, $shortcode_base, $atts );
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
$classes .= ' vc_row';
}
// Output the element
$output = '';
$output .= $cols_gap_styles . $inner_output;
$output .= '';
} else {
$output .= $inner_output;
}
$output .= '';
if ( $sticky == 1 ) {
$output .= '';
}
echo $output;