????
| Current Path : /home2/morganrand/www/wp-content/themes/wanderfuls/vcex_templates/ |
| Current File : /home2/morganrand/www/wp-content/themes/wanderfuls/vcex_templates/vcex_heading.php |
<?php
/**
* Visual Composer Heading
*
* @package Wanderfuls WordPress Theme
* @subpackage VC Templates
* @version 3.0.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Not needed in admin ever
if ( is_admin() ) {
return;
}
// Get and extract shortcode attributes
$atts = vc_map_get_attributes( $this->getShortcode(), $atts );
extract( $atts );
// Get text
if ( 'post_title' == $source ) {
$text = get_the_title();
} elseif( 'custom_field' == $source ) {
$text = $custom_field ? get_post_meta( get_the_ID(), $custom_field, true ) : '';
} else {
$text = do_shortcode( htmlspecialchars_decode( $text, ENT_COMPAT ) );
}
// Return if no heading
if ( empty( $text ) ) {
return;
}
// Sanitize data
$tag = $tag ? $tag : 'div';
// Define vars
$wrap_classes = array( 'vcex-heading', 'reset-styles' );
$link_html = array();
$wrap_data = array();
$icon_left = $icon_right = '';
// Add classes to wrapper
if ( $style ) {
$wrap_classes[] = 'vcex-heading-'. $style;
}
if ( $visibility ) {
$wrap_classes[] = $visibility;
}
if ( $css ) {
$wrap_classes[] = vc_shortcode_custom_css_class( $css );
}
if ( $el_class ) {
$wrap_classes[] = $this->getExtraClass( $el_class );
}
// Load custom font
if ( $font_family ) {
tb_enqueue_google_font( $font_family );
}
// Add inline style
$heading_style_attr = vcex_inline_style( array(
'color' => $color,
'font_family' => $font_family,
'font_size' => $font_size,
'letter_spacing' => $letter_spacing,
'font_weight' => $font_weight,
'text_align' => $text_align,
'line_height' => $line_height,
) );
// Get link data
$link = vcex_build_link( $link );
if ( $link ) {
$link_html[] = 'href="'. $link['url'] .'"';
$link_html[] = 'title="'. $link['title'] .'"';
$link_html[] = 'target="'. $link['target'] .'"';
$tag = 'a';
if ( $link_local_scroll ) {
$wrap_classes[] = 'local-scroll-link';
}
}
// Color hover
if ( $color_hover ) {
$wrap_classes[] = 'tb-data-hover';
$wrap_data[] = 'data-hover-color="'. $color_hover .'"';
}
if ( $background_hover ) {
if ( ! isset( $wrap_classes['tb-data-hover'] ) ) {
$wrap_classes['tb-data-hover'] = 'tb-data-hover';
}
$wrap_classes[] = 'transition-all';
$wrap_data[] = 'data-hover-background="'. $background_hover .'"';
}
if ( 'true' == $hover_white_text ) {
$wrap_classes[] = 'tb-hover-white-text';
}
// Implode data
$wrap_classes = implode( ' ', $wrap_classes );
$link_html = implode( ' ', $link_html );
$wrap_data = implode( ' ', $wrap_data );
// Inline js
if ( $color_hover || $background_hover ) {
vcex_inline_js( 'data_hover' );
}
// Inner style
$inner_style_attr = vcex_inline_style( array(
'border_color' => $inner_bottom_border_color,
) );
// Icon output
if ( $icon = vcex_get_icon_class( $atts, 'icon' ) ) {
// Enqueue needed icon font
if ( 'fontawesome' != $icon_type ) {
vcex_enqueue_icon_font( $icon_type );
}
// Icon style
$icon_style_attr = vcex_inline_style( array(
'color' => $icon_color,
) );
// Icon output
$icon_output = '<div class="vcex-icon-wrap vcex-icon-position-'. $icon_position .'"'. $icon_style_attr .'><span class="'. $icon .'"></span></div>';
// Add icon to heading
if ( 'left' == $icon_position ) {
$icon_left = $icon_output;
} else {
$icon_right = $icon_output;
}
}
// Generate heading
$output = '<'. $tag .' class="'. $wrap_classes .'"'. $link_html . $heading_style_attr . $wrap_data .'>';
$output .= '<span class="vcex-heading-inner clr"'. $inner_style_attr .'>';
$output .= $icon_left;
$output .= $text;
$output .= $icon_right;
$output .= '</span>';
$output .= '</'. $tag .'>';
// Echo heading
echo $output;