File: /opt/aphex/sites/anna-arpa.com/wp-content/plugins/page_builder_elements/page_builder.php
<?php
/**
* Plugin Name: Garage Theme: Page Builder Elements
* Plugin URI: http://themeforest.net/user/evolle
* Description: Garage Lifestyle & Magazine Blog Theme
* Version: 1.2
* Author: Garage Theme
* Author URI: http://www.evollethemes.com/
*/
if(function_exists('vc_map')){
vc_remove_element("vc_widget_sidebar");
/*
* Visual Composer Thump Image
*/
vc_add_shortcode_param( 'imagethup', 'image_featured_param_name_field' );
function image_featured_param_name_field( $settings, $value ) {
return '<div class="my_param_block">'
.'<input name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-textinput ' .
esc_attr( $settings['param_name'] ) . ' ' .
esc_attr( $settings['type'] ) . '_field" type="hidden" value="' . esc_attr( $value ) . '" />
<img src="'.esc_attr( $value ).'">'.
'</div>'; // This is html markup that will be outputted in content elements edit form
}
/*
* Visual Composer Uniq id for pagination
*/
vc_add_shortcode_param( 'my_param_hidden', 'my_param_settings_field_post_hidden' );
function my_param_settings_field_post_hidden( $settings, $value ) {
return '<div class="my_param_block">'
.'<input name="' . esc_attr( $settings['param_name'] ) . '" class="wpb_vc_param_value wpb-textinput ' .
esc_attr( $settings['param_name'] ) . ' ' .
esc_attr( $settings['type'] ) . '_field" type="hidden" value="' . esc_attr( $value ) . '" />' .
'</div>'; // This is html markup that will be outputted in content elements edit form
}
}
/**
* Add user contact method
*
* @return string
* @param $evo_profile_fields
*/
if ( ! function_exists( 'evo_custom_profile_methods' ) ) {
function evo_custom_profile_methods( $evo_profile_fields ) {
$evo_profile_fields['facebook'] = esc_html__( 'Facebook URL', 'garage' );
$evo_profile_fields['twitter'] = esc_html__( 'Twitter URL', 'garage' );
$evo_profile_fields['instagram'] = esc_html__( 'Instagram URL', 'garage' );
$evo_profile_fields['googleplus'] = esc_html__( 'Google+ URL', 'garage' );
$evo_profile_fields['pinterest'] = esc_html__( 'Pinterest URL', 'garage' );
$evo_profile_fields['tumblr'] = esc_html__( 'Tumblr URL', 'garage' );
$evo_profile_fields['authorprofession'] = esc_html__( 'Author Profession', 'garage' );
return $evo_profile_fields;
}
}
add_filter( 'user_contactmethods', 'evo_custom_profile_methods' );
/*
* Visual Composer Category
*/
function evo_visual_composer_category(){
$blog_categories = get_categories(array(
'parent' => 0));
$blog_categories_array = array();
$blog_categories_array[__("None Select Category", 'garage')] = "-";
foreach($blog_categories as $category) {
$blog_categories_array[$category->name] = $category->cat_ID;
}
return $blog_categories_array;
}
function garage_post_social_share(){
if (ot_get_option('evo_blog_single_social', 'on') == 'on'){
if (!in_array('share_button', evo_blog_settings())) {
?>
<div class="evo-share-post evo-single-top">
<span class="evo-small-title"><?php echo esc_html__('Share This Articles', 'garage'); ?></span>
<div class="evo-share-post-inner">
<?php if (!in_array('facebook', evo_share_settings())): ?>
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>" class="share-flex facebook"><i class="fab fa-facebook-f"></i><span><?php echo esc_html__('Share this article', 'garage'); ?></span></a>
<?php endif; ?>
<?php if (!in_array('twitter', evo_share_settings())): ?>
<a href="https://twitter.com/share?text=<?php echo urlencode(html_entity_decode(get_the_title(), ENT_COMPAT, 'UTF-8')); ?>&url=<?php the_permalink(); ?>" class="share-flex twitter"><i class="fab fa-twitter"></i><span><?php echo esc_html__('Share this article', 'garage'); ?></span></a>
<?php endif; ?>
<div class="evo-share-small-buttons">
<div class="dropdown-menu">
<?php if (!in_array('pinterest', evo_share_settings())): ?>
<a href="https://pinterest.com/pin/create/button/?url=<?php echo get_permalink(); ?>&media=<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>&description=<?php echo rawurlencode( get_the_title() ); ?>" class="share-normal pinterest"><i class="fab fa-pinterest-p"></i></a>
<?php endif; ?>
<?php if (!in_array('google', evo_share_settings())): ?>
<a href="https://plus.google.com/share?url=<?php the_permalink(); ?>" class="share-normal google"><i class="fab fa-google-plus-g"></i></a>
<?php endif; ?>
<?php if (!in_array('linkedin', evo_share_settings())): ?>
<a class="linkedin share-normal" href="https://www.linkedin.com/cws/share?url=<?php echo get_permalink(); ?>&media=<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>&description=<?php echo rawurlencode( get_the_title() ); ?>" target="_blank"><i class="fab fa-linkedin-in"></i></a>
<?php endif; ?>
<?php if (!in_array('whatsapp', evo_share_settings())): ?>
<a href="whatsapp://send?text=<?php the_permalink(); ?>" class="share-normal whatsapp"><i class="fab fa-whatsapp"></i></a>
<?php endif; ?>
<?php if (!in_array('mail', evo_share_settings())): ?>
<a href="mailto:<?php echo get_option('admin_email'); ?>" class="share-normal mail"><i class="far fa-envelope"></i></a>
<?php endif; ?>
</div><!-- dropdown-menu -->
<a href="javascript:;" class="share-normal" data-toggle="dropdown"><i class="fas fa-plus"></i></a>
</div><!-- evo-share-small-buttons -->
</div><!-- evo-share-post-inner -->
</div><!-- evo-share-post -->
<?php
}
}
}
/******************************************* FEATURED POST START *******************************************/
if(function_exists('vc_map')){
$posts_list = get_posts(array(
'orderby' => 'title',
'order' => 'ASC',
'post_type' => 'post'
));
vc_map( array(
"name" => esc_html__("Featured Posts", 'garage'),
"base" => "evo_featured_post",
"class" => "",
"category" => esc_html__("Garage Theme", 'garage'),
"icon" => get_template_directory_uri().'/includes/evo_admin/assets/images/vc_icon/evo_featured_post.png',
"description" =>esc_html__( 'Featured posts widget.','garage'),
"params" => array(
//Featured Style
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Style",'garage'),
"description" => esc_html__("Select the design element.",'garage'),
"param_name" => "style",
"value" => array(
esc_html__("Style 1", 'garage') => "style1",
esc_html__("Style 2", 'garage') => "style2",
esc_html__("Style 3", 'garage') => "style3",
esc_html__("Style 4", 'garage') => "style4",
esc_html__("Style 5", 'garage') => "style5",
)
),
array(
'type' => 'dropdown',
'class' => '',
'heading' => esc_html__('Margin top on or off','garage'),
'description' => esc_html__('Margin top on or off','garage'),
'param_name' => 'margin_top',
'value' => array(
esc_html__('On', 'garage') => 'module-margin-top',
esc_html__('Off', 'garage') => '',
)
),
array(
"type" => "checkbox",
"class" => "",
"heading" => esc_html__("Featured Design Settings",'garage'),
"description" => sprintf(esc_html__("From here you can make design settings for featured. Gradient, Autoplay, Title, Border, Arrow settings. %s",'garage'), '<code>Check the feature you want to turn off.</code>'),
"param_name" => "featured_post_design_settings",
"value" => array(
esc_html__("Autoplay", 'garage') => "autoplay",
esc_html__("Arrow", 'garage') => "arrow",
esc_html__("Dots", 'garage') => "dots",
),
),
array(
"type" => "checkbox",
"class" => "",
"heading" => esc_html__("Featured Settings",'garage'),
"description" => sprintf(esc_html__("You can close and open areas in the design Category, Share Count, Views, Like, Author, Date, Comment Count, Post Desc and Title. %s",'garage'), '<code>Check the feature you want to turn off.</code>'),
"param_name" => "featured_post_featured_settings",
"value" => array(
esc_html__("Post Author", 'garage') => "post-author",
esc_html__("Post Date", 'garage') => "post-date",
esc_html__("Post Comment Count", 'garage') => "post-comment"
),
),
/******************************************* FILTER START *******************************************/
//Pos Order By
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Post Order By",'garage'),
"description" => esc_html__("Post Order By",'garage'),
"param_name" => "featured_order_by",
'group' => esc_html__( 'Query', 'garage' ),
"value" => array(
esc_html__("None Select", 'garage') => "none-select",
esc_html__("Date", 'garage') => 'date',
esc_html__("Random", 'garage') => 'rand',
esc_html__("Most Popular Post", 'garage') => 'meta_value_num',
esc_html__("Comment Count", 'garage') => 'comment_count',
)
),
//Post Count
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Post Count', 'garage'),
"description" => esc_html__('Enter Post Count', 'garage'),
'group' => esc_html__( 'Query', 'garage' ),
"param_name" => "featured_post_count",
"value" => "",
),
//Exclude Post
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Posts",'garage'),
"description" => sprintf(esc_html__("Enter exclude posts id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
'group' => esc_html__( 'Query', 'garage' ),
"param_name" => "featured_exclude_postid",
"value" => "",
),
//Exclude Category
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Category",'garage'),
"description" => sprintf(esc_html__("Enter exclude category id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "featured_exclude_category",
'group' => esc_html__( 'Query', 'garage' ),
"value" => "",
),
//Exclude Tag
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Tags",'garage'),
"description" => sprintf(esc_html__("Enter exclude tag id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "featured_exclude_tag",
'group' => esc_html__( 'Query', 'garage' ),
"value" => "",
),
//Posts Source
array(
"type" => "dropdown",
"heading" => "Post Source",
"param_name" => "featured_query_source",
'group' => esc_html__( 'Query', 'garage' ),
"value" => array(
'Post ID' => "post-id",
'By Category' => "by-category",
'By Author' => "by-author",
),
"std" => "post-id",
"description" => "Select a query for posts you want to show"
),
//Post ID
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Post ID', 'garage'),
"description" => sprintf(esc_html__("Enter Post id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "featured_postid",
"value" => "",
'group' => esc_html__( 'Query', 'garage' ),
"dependency" => Array('element' => "featured_query_source", 'value' => array('post-id'))
),
//By Category Select
array(
"type" => "dropdown",
"heading" => "Post Categories",
"param_name" => "featured_categories",
"value" => evo_visual_composer_category(),
'group' => esc_html__( 'Query', 'garage' ),
"description" => "Select category",
"dependency" => Array('element' => "featured_query_source", 'value' => array('by-category'))
),
//Authot ID Select
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Author ID's",'garage'),
"description" => sprintf(esc_html__("Enter Author id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "featured_author_id",
"value" => "",
'group' => esc_html__( 'Query', 'garage' ),
"dependency" => Array('element' => "featured_query_source", 'value' => array('by-author'))
),
/******************************************* FILTER END *******************************************/
)
));
}
function evo_featured_post( $atts, $content = null ) {
$atts = vc_map_get_attributes( 'evo_featured_post', $atts );
extract( $atts );
$image_hover_style = ot_get_option('image_hover_color');
$general_color = ot_get_option('general_color');
$atts = shortcode_atts(
array(
'style' => '',
'featured_post_design_settings' => '',
'featured_post_featured_settings' => '',
'featured_order_by' => '',
'featured_post_count' => '',
'featured_exclude_postid' => '',
'featured_exclude_category' => '',
'featured_exclude_tag' => '',
'featured_query_source' => '',
'featured_postid'=> '',
'featured_categories'=> '',
'featured_author_id'=> '',
'margin_top' => '',
), $atts
);
$output = '';
/*------------- featured_postid -------------*/
if( !empty( $atts['featured_postid'] ) ) :
$featured_postid = $atts['featured_postid'];
$featured_postid = explode( ',', $featured_postid );
else:
$featured_postid = "";
endif;
/*------------- featured_author_id -------------*/
if( !empty( $atts['featured_author_id'] ) ) :
$featured_author_id = $atts['featured_author_id'];
$featured_author_id = explode( ',', $featured_author_id );
else:
$featured_author_id = "";
endif;
/*------------- featured_exclude_postid -------------*/
if( !empty( $atts['featured_exclude_postid'] ) ) :
$featured_exclude_postid = $atts['featured_exclude_postid'];
$featured_exclude_postid = explode( ',', $featured_exclude_postid );
else:
$featured_exclude_postid = "";
endif;
/*------------- featured_exclude_category -------------*/
if( !empty( $atts['featured_exclude_category'] ) ) :
$featured_exclude_category = $atts['featured_exclude_category'];
$featured_exclude_category = explode( ',', $featured_exclude_category );
else:
$featured_exclude_category = "";
endif;
/*------------- featured_exclude_tag -------------*/
if( !empty( $atts['featured_exclude_tag'] ) ) :
$featured_exclude_tag = $atts['featured_exclude_tag'];
$featured_exclude_tag = explode( ',', $featured_exclude_tag );
else:
$featured_exclude_tag = "";
endif;
$featured_query = array(
'post__in' => $featured_postid,
'author__in' => $featured_author_id,
'posts_per_page' => $atts['featured_post_count'],
'post_status' => 'publish',
'orderby' => $atts['featured_order_by'],
'cat' => $atts['featured_categories'],
'post__not_in' => $featured_exclude_postid,
'category__not_in' => $featured_exclude_category,
'tag__not_in' => $featured_exclude_tag,
'ignore_sticky_posts' => true,
'post_type' => 'post'
);
if ($atts['featured_order_by']=='meta_value_num') {
$featured_query = wp_parse_args(
array(
'meta_key' => 'post_views_count',
'orderby' => $atts['featured_order_by'],
)
, $featured_query );
}
else {
$featured_query = wp_parse_args(
array(
'meta_key' => '',
'orderby' => $atts['featured_order_by'],
)
, $featured_query );
}
/*------------- Query Arg End -------------*/
//AUTOPLAY
if (strstr($atts['featured_post_design_settings'], 'autoplay')) {
$evo_ft_autoplay_on_off = 'true';
}
else{
$evo_ft_autoplay_on_off = 'false';
}
//ARROWS
if (strstr($atts['featured_post_design_settings'], 'arrow')) {
$evo_ft_arrow_on_off = 'true';
}
else{
$evo_ft_arrow_on_off = 'false';
}
//DOTS
if (strstr($atts['featured_post_design_settings'], 'dots')) {
$evo_ft_dots_on_off = 'true';
}
else{
$evo_ft_dots_on_off = 'false';
}
$margin_top = $atts['margin_top'];
if (is_rtl()) {
$rtl_settings = 'true';
}
else{
$rtl_settings = 'false';
}
//STYLE 1
if ($atts['style'] == 'style1') {
$output .='
<div class="evo-module evo-featured '.$margin_top .'">
<div class="evo-featured-style-a evo-post-center container">
<div class="evo-slider"
data-arrows="'.$evo_ft_arrow_on_off.'"
data-autoplay="'.$evo_ft_autoplay_on_off.'"
data-dots="'.$evo_ft_dots_on_off.'"
data-speed="1000"
data-autoplay="false"
data-autospeed="2000"
data-evofade="false"
data-item="1"
data-slidetoitem="1"
data-rtl="'.$rtl_settings.'">';
$posts = new WP_Query( $featured_query );
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post();
$output .='
<article class="evo-post post post-overlay" itemscope="itemscope" itemtype="http://schema.org/Article" style="background-image: url('.garage_post_image_url('garage_image_two').');">
<div class="evo-overlay-wrap">
<div class="evo-overlay-inner">
<div class="evo-decor-border-top"></div>
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta">';
if (!strstr($atts['featured_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .= '.
</div><!-- evo-post-meta -->
<div class="evo-decor-border-bottom"></div>
</div><!-- evo-overlay-inner -->
</div><!-- evo-overlay-wrap -->
<a href="'.get_the_permalink().'" class="evo-overlay-link" tabindex="0"></a>
</article><!-- evo-post -->
';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-slider -->
</div><!-- evo-featured-style-a -->
</div><!-- evo-module -->
';
return $output;
}
//STYLE 2
if ($atts['style'] == 'style2') {
$output .='
<div class="evo-module evo-featured '.$margin_top .'">
<div class="evo-featured-style-b evo-post-center arrow-normal arrow-transparent">
<div class="evo-slider"
data-arrows="'.$evo_ft_arrow_on_off.'"
data-autoplay="'.$evo_ft_autoplay_on_off.'"
data-dots="'.$evo_ft_dots_on_off.'"
data-speed="1000"
data-autoplay="false"
data-autospeed="2000"
data-evofade="false"
data-item="1"
data-slidetoitem="1"
data-rtl="'.$rtl_settings.'">';
$posts = new WP_Query( $featured_query );
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post();
$output .='
<article class="evo-post post post-overlay" itemscope="itemscope" itemtype="http://schema.org/Article" style="background-image: url('.garage_post_image_url('garage_image_theree').');">
<div class="evo-overlay-wrap">
<div class="evo-overlay-inner">
<div class="evo-decor-border-top"></div>
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta">';
if (!strstr($atts['featured_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .= '.
</div><!-- evo-post-meta -->
<div class="evo-decor-border-bottom"></div>
</div><!-- evo-overlay-inner -->
</div><!-- evo-overlay-wrap -->
<a href="'.get_the_permalink().'" class="evo-overlay-link" tabindex="0"></a>
</article><!-- evo-post -->
';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-slider -->
</div><!-- evo-featured-style-a -->
</div><!-- evo-module -->
';
return $output;
}
//STYLE 3
if ($atts['style'] == 'style3') {
$output .='
<div class="evo-module evo-featured '.$margin_top .'">
<div class="evo-featured-style-c evo-post-center evo-small-inner evo-featured-padding">
<div class="evo-slider"
data-arrows="'.$evo_ft_arrow_on_off.'"
data-autoplay="'.$evo_ft_autoplay_on_off.'"
data-dots="'.$evo_ft_dots_on_off.'"
data-speed="1000"
data-autoplay="false"
data-autospeed="2000"
data-evofade="false"
data-item="4"
data-slidetoitem="1"
data-rtl="'.$rtl_settings.'">';
$posts = new WP_Query( $featured_query );
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post();
$output .='
<article class="evo-post post post-overlay" itemscope="itemscope" itemtype="http://schema.org/Article" style="background-image: url('.garage_post_image_url('garage_image_four').');">
<div class="evo-overlay-wrap">
<div class="evo-overlay-inner">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta">';
if (!strstr($atts['featured_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .= '.
</div><!-- evo-post-meta -->
</div><!-- evo-overlay-inner -->
</div><!-- evo-overlay-wrap -->
<a href="'.get_the_permalink().'" class="evo-overlay-link" tabindex="0"></a>
</article><!-- evo-post -->
';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-slider -->
</div><!-- evo-featured-style-a -->
</div><!-- evo-module -->
';
return $output;
}
//STYLE 4
if ($atts['style'] == 'style4') {
$output .='
<div class="evo-module evo-featured '.$margin_top .'">
<div class="evo-featured-style-d evo-post-center evo-featured-padding">
<div class="evo-slider"
data-arrows="'.$evo_ft_arrow_on_off.'"
data-autoplay="'.$evo_ft_autoplay_on_off.'"
data-dots="'.$evo_ft_dots_on_off.'"
data-speed="1000"
data-autoplay="false"
data-autospeed="2000"
data-evofade="false"
data-item="2"
data-slidetoitem="1"
data-rtl="'.$rtl_settings.'">';
$posts = new WP_Query( $featured_query );
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post();
$output .='
<article class="evo-post post post-overlay" itemscope="itemscope" itemtype="http://schema.org/Article" style="background-image: url('.garage_post_image_url('garage_image_four').');">
<div class="evo-overlay-wrap">
<div class="evo-overlay-inner">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta">';
if (!strstr($atts['featured_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .= '.
</div><!-- evo-post-meta -->
</div><!-- evo-overlay-inner -->
</div><!-- evo-overlay-wrap -->
<a href="'.get_the_permalink().'" class="evo-overlay-link" tabindex="0"></a>
</article><!-- evo-post -->
';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-slider -->
</div><!-- evo-featured-style-a -->
</div><!-- evo-module -->
';
return $output;
}
//STYLE 5
if ($atts['style'] == 'style5') {
$featured_query = wp_parse_args(
array(
'posts_per_page' => '2',
)
, $featured_query );
$output .='
<div class="evo-module evo-featured '.$margin_top .'">
<div class="evo-featured-style-e evo-post-center container">
<div class="row">';
$posts = new WP_Query( $featured_query );
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post();
if ($i == 1) {
$output .='
<div class="evo-featured-large-column col-md-9">
<article class="evo-post post '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article">
<figure class="evo-post-image">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_four').'
</a>
</figure>
<div class="evo-ft-post-large-body">
<div class="evo-post-meta">';
if (!strstr($atts['featured_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
'.garage_post_title('h3', 'evo-entry-title', true).'
</div><!-- evo-ft-post-large-body -->
</article><!-- post -->
</div><!-- evo-featured-large-column -->
';
}
else {
$output .='
<div class="evo-featured-small-column col-md-3">
<article class="evo-post post '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article">
<div class="evo-ft-white-body">
<div class="evo-post-meta">';
if (!strstr($atts['featured_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['featured_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-content entry-content">';
$output .= garage_post_excerpt(get_the_excerpt(), '13');
$output .= '</div><!-- entry-content -->
</div><!-- evo-ft-white-body -->
<figure class="evo-post-image">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_four').'
</a>
</figure>
</article><!-- post -->
</div><!-- evo-featured-small-column -->
';
}
$i++; endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- row -->
</div><!-- evo-featured-style-e -->
</div><!-- evo-module -->
';
return $output;
}
}
add_shortcode("evo_featured_post", "evo_featured_post");
/******************************************* CATEGORY POST START *******************************************/
if(function_exists('vc_map')){
$posts_list = get_posts(array(
'orderby' => 'title',
'order' => 'ASC',
'post_type' => 'post'
));
vc_map( array(
"name" => esc_html__("Category Posts", 'garage'),
"base" => "evo_category_post",
"class" => "",
"category" => esc_html__("Garage Theme", 'garage'),
"icon" => get_template_directory_uri().'/includes/evo_admin/assets/images/vc_icon/evo_category_post.png',
"description" =>esc_html__( 'Featured posts widget.','garage'),
"params" => array(
//Featured Style
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Style",'garage'),
"description" => esc_html__("Select the design element.",'garage'),
"param_name" => "style",
"value" => array(
esc_html__("Style 1", 'garage') => "style1",
esc_html__("Style 2", 'garage') => "style2",
esc_html__("Style 3", 'garage') => "style3",
esc_html__("Style 4", 'garage') => "style4",
esc_html__("Style 5", 'garage') => "style5",
esc_html__("Style 6", 'garage') => "style6",
esc_html__("Style 7", 'garage') => "style7",
esc_html__("Style 8", 'garage') => "style8",
)
),
//Style 1
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Select Design",'garage'),
"param_name" => "category_style_1",
"value" => array(
esc_html__("Style 1", 'garage') => "style1",
esc_html__("Style 2", 'garage') => 'style2',
),
"description" => sprintf(esc_html__("You can choose to have %s of this design.",'garage'),"<code>2 different style</code>"),
'dependency' => Array('element' => "style", 'value' => array('style1')),
),
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'style_one_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/category/style_1_1.jpg',
'dependency' => Array('element' => "category_style_1", 'value' => array('style1'))
),
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'style_one_two_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/category/style_1_2.jpg',
'dependency' => Array('element' => "category_style_1", 'value' => array('style2'))
),
//Style 3
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'styletwoimage',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/category/style_2.jpg',
'dependency' => Array('element' => "style", 'value' => array('style2'))
),
//Style 3
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'stylethereeimage',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/category/style_3.jpg',
'dependency' => Array('element' => "style", 'value' => array('style3'))
),
//Style 4
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'stylefourimage',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/category/style_4.jpg',
'dependency' => Array('element' => "style", 'value' => array('style4'))
),
//Style 5
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'stylefiveimage',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/category/style_5.jpg',
'dependency' => Array('element' => "style", 'value' => array('style5'))
),
//Style 6
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'stylesiximage',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/category/style_6.jpg',
'dependency' => Array('element' => "style", 'value' => array('style6'))
),
//Style 7
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'stylesevenimage',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/category/style_7.jpg',
'dependency' => Array('element' => "style", 'value' => array('style7'))
),
//Style 8
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'styleeightimage',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/category/style_8.jpg',
'dependency' => Array('element' => "style", 'value' => array('style8'))
),
//Margin On / Off
array(
'type' => 'dropdown',
'class' => '',
'heading' => esc_html__('Margin top on or off','garage'),
'description' => esc_html__('Margin top on or off','garage'),
'param_name' => 'margin_top',
'value' => array(
esc_html__('On', 'garage') => 'module-margin-top',
esc_html__('Off', 'garage') => '',
)
),
//Title Text
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Title Text",'garage'),
"param_name" => "subcategory_title",
),
//Design Settings
array(
"type" => "checkbox",
"class" => "",
"heading" => esc_html__("Design Settings",'garage'),
"description" => sprintf(esc_html__("You can close and open areas in the design Category, Share Count, Views, Like, Author, Date, Comment Count, Post Desc and Title. %s",'garage'), '<code>Check the feature you want to turn off.</code>'),
"param_name" => "category_post_featured_settings",
"value" => array(
esc_html__("Post Author", 'garage') => "post-author",
esc_html__("Post Date", 'garage') => "post-date",
esc_html__("Post Excerpt", 'garage') => "post-excerpt",
esc_html__("Post Continue Button", 'garage') => "post-continue",
esc_html__("Post Comment Count", 'garage') => "post-comment",
),
),
/******************************************* FILTER START *******************************************/
//Pos Order By
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Post Order By",'garage'),
"description" => esc_html__("Post Order By",'garage'),
"param_name" => "order_by",
'group' => esc_html__( 'Query', 'garage' ),
"value" => array(
esc_html__("None Select", 'garage') => "none-select",
esc_html__("Date", 'garage') => 'date',
esc_html__("Random", 'garage') => 'rand',
esc_html__("Most Popular Post", 'garage') => 'meta_value_num',
esc_html__("Comment Count", 'garage') => 'comment_count',
)
),
//Post Count
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Post Count', 'garage'),
"description" => esc_html__('Enter Post Count', 'garage'),
'group' => esc_html__( 'Query', 'garage' ),
"param_name" => "post_count",
"value" => "",
"dependency" => Array('element' => "style", 'value' => array('style3','style11'))
),
//Exclude Post
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Posts",'garage'),
"description" => sprintf(esc_html__("Enter exclude posts id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
'group' => esc_html__( 'Query', 'garage' ),
"param_name" => "exclude_postid",
"value" => "",
),
//Exclude Category
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Category",'garage'),
"description" => sprintf(esc_html__("Enter exclude category id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "exclude_category",
'group' => esc_html__( 'Query', 'garage' ),
"value" => "",
),
//Exclude Tag
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Tags",'garage'),
"description" => sprintf(esc_html__("Enter exclude tag id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "exclude_tag",
'group' => esc_html__( 'Query', 'garage' ),
"value" => "",
),
//Posts Source
array(
"type" => "dropdown",
"heading" => "Post Source",
"param_name" => "query_source",
'group' => esc_html__( 'Query', 'garage' ),
"value" => array(
'Post ID' => "post-id",
'By Category' => "by-category",
'By Author' => "by-author",
),
"std" => "post-id",
"description" => "Select a query for posts you want to show"
),
//Post ID
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Post ID', 'garage'),
"description" => sprintf(esc_html__("Enter Post id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "postid",
"value" => "",
'group' => esc_html__( 'Query', 'garage' ),
"dependency" => Array('element' => "query_source", 'value' => array('post-id'))
),
//By Category Select
array(
"type" => "dropdown",
"heading" => "Post Categories",
"param_name" => "cat",
"value" => evo_visual_composer_category(),
'group' => esc_html__( 'Query', 'garage' ),
"description" => "Select category",
"dependency" => Array('element' => "query_source", 'value' => array('by-category'))
),
//Authot ID Select
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Author ID's",'garage'),
"description" => sprintf(esc_html__("Enter Author id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "author_id",
"value" => "",
'group' => esc_html__( 'Query', 'garage' ),
"dependency" => Array('element' => "query_source", 'value' => array('by-author'))
),
/******************************************* FILTER END *******************************************/
)
));
}
function evo_category_post( $atts, $content = null ) {
$atts = vc_map_get_attributes( 'evo_category_post', $atts );
extract( $atts );
$image_hover_style = ot_get_option('image_hover_color');
$title_hover_style = ot_get_option('title_hover_style');
$general_color = ot_get_option('general_color');
$atts = shortcode_atts(
array(
"style" => "",
"category_style_1" => "",
"category_style_2" => "",
"category_style_3" => "",
'stylefourimage' => "",
'stylefiveimage' => "",
'stylesiximage' => "",
"category_style_7" => "",
"category_style_8" => "",
"category_style_9" => "",
"category_style_10" => "",
"category_style_12" => "",
"content_italic_onoff" => "",
"category_post_featured_settings" => "",
"gradient_onoff" => "",
"gradient_style" => "",
"title_onoff" => "",
"subcategory_title" => "",
"subcategory_ajax_onoff" => "",
"subcategory_onoff" => "",
"subcategory_style" => "",
"subcategory_style_two_border"=>"",
"subcategory_style_two_position"=>"",
"order_by" => "",
"post_count" => "",
"exclude_postid" => "",
"exclude_category" => "",
"exclude_tag" => "",
"query_source" => "",
"postid" => "",
"cat" => "" ,
"author_id" => "",
"margin_top" => ""
), $atts
);
$output = '';
/*------------- postid -------------*/
if( !empty( $atts['postid'] ) ) :
$postid = $atts['postid'];
$postid = explode( ',', $postid );
else:
$postid = "";
endif;
/*------------- author_id -------------*/
if( !empty( $atts['author_id'] ) ) :
$author_id = $atts['author_id'];
$author_id = explode( ',', $author_id );
else:
$author_id = "";
endif;
/*------------- exclude_postid -------------*/
if( !empty( $atts['exclude_postid'] ) ) :
$exclude_postid = $atts['exclude_postid'];
$exclude_postid = explode( ',', $exclude_postid );
else:
$exclude_postid = "";
endif;
/*------------- featured_exclude_category -------------*/
if( !empty( $atts['exclude_category'] ) ) :
$exclude_category = $atts['exclude_category'];
$exclude_category = explode( ',', $exclude_category );
else:
$exclude_category = "";
endif;
/*------------- exclude_tag -------------*/
if( !empty( $atts['exclude_tag'] ) ) :
$exclude_tag = $atts['exclude_tag'];
$exclude_tag = explode( ',', $exclude_tag );
else:
$exclude_tag = "";
endif;
if (is_rtl()) {
$rtl_settings = 'true';
}
else{
$rtl_settings = 'false';
}
/*------------- Query Start -------------*/
$query = array(
'post__in' => $postid,
'author__in' => $author_id,
'post_status' => 'publish',
'orderby' => $atts['order_by'],
'cat' => $atts['cat'],
'post__not_in' => $exclude_postid,
'category__not_in' => $exclude_category,
'tag__not_in' => $exclude_tag,
'ignore_sticky_posts' => true,
'post_type' => 'post'
);
if ($atts['order_by']=='meta_value_num') {
$query = wp_parse_args(
array(
'meta_key' => 'post_views_count',
'orderby' => $atts['order_by'],
)
, $query );
}
else {
$query = wp_parse_args(
array(
'meta_key' => '',
'orderby' => $atts['order_by'],
)
, $query );
}
$margin_top = $atts['margin_top'];
/*------------- Style 1 -------------*/
if ($atts["style"] == "style1") {
if ($atts['category_style_1'] == 'style1') {
$query = wp_parse_args(
array(
'posts_per_page' => '4',
)
, $query );
$output.='
<div class="evo-module evo-cat-module-a evo-column-2 '.$margin_top .'">';
if (!empty($atts['subcategory_title'])) {
$output .='<div class="evo-module-title center style-b"><h4 class="evo-title">'.$atts['subcategory_title'].'</h4></div>';
}
$output .='
<div class="evo-modulle-inner evo-row evo-flex">';
$posts = new WP_Query( $query );
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post();
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<article class="evo-post post evo-post-header-top evo-cat-color evo-cat-line '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_five').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
<div class="evo-post-meta top">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_category();
}
$output .='
</div><!-- evo-post-meta -->
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_excerpt(get_the_excerpt(), '13');
}
$output .= '
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-modulle-inner -->
</div><!-- evo-module -->
';
}
else{
$query = wp_parse_args(
array(
'posts_per_page' => '6',
)
, $query );
$output.='
<div class="evo-module evo-cat-module-a evo-column-3 evo-full '.$margin_top .'">';
if (!empty($atts['subcategory_title'])) {
$output .='<div class="evo-module-title center style-b"><h4 class="evo-title">'.$atts['subcategory_title'].'</h4></div>';
}
$output .='
<div class="evo-modulle-inner evo-row evo-flex">';
$posts = new WP_Query( $query );
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post();
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<article class="evo-post post evo-post-header-top evo-cat-color evo-cat-line '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_five').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
<div class="evo-post-meta top">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_category();
}
$output .='
</div><!-- evo-post-meta -->
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['category_post_featured_settings'], 'post-excerpt')) {
$output .= garage_post_excerpt(get_the_excerpt(), '13');
}
$output .= '
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-modulle-inner -->
</div><!-- evo-module -->
';
}
return $output;
}
elseif ($atts["style"] == "style2") {
$query = wp_parse_args(
array(
'posts_per_page' => '4',
)
, $query );
$output .='
<div class="evo-module evo-cat-module-b evo-full '.$margin_top .'">';
if (!empty($atts['subcategory_title'])) {
$output .='<div class="evo-module-title center style-b"><h4 class="evo-title">'.$atts['subcategory_title'].'</h4></div>';
}
$output .='
<div class="evo-modulle-inner evo-row">
<div class="col-md-9 col-sm-12 col-xs-12 evo-lr-posts">
';
$posts = new WP_Query( $query );
$i = 1;
while ( $posts->have_posts() ) : $posts->the_post();
//Category Color
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
if ($i == 1) {
$output .='
<article class="evo-post post evo-cat-color '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_excerpt(get_the_excerpt(), '13');
}
$output .= '
</div><!-- evo-entry-content -->
<div class="evo-read-more">';
if (!strstr($atts['category_post_featured_settings'], 'post-continue')) {
$output .= garage_post_continue(esc_html__('Read More', 'garage'));
}
$output .='
</div><!-- evo-read-more -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
}
elseif ($i == 2) {
$output .='
<article class="evo-post post evo-cat-color '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_excerpt(get_the_excerpt(), '13');
}
$output .= '
</div><!-- evo-entry-content -->
<div class="evo-read-more">';
if (!strstr($atts['category_post_featured_settings'], 'post-continue')) {
$output .= garage_post_continue(esc_html__('Read More', 'garage'));
}
$output .='
</div><!-- evo-read-more -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
}
elseif ($i == 3) {
$output .='
</div><!-- evo-lr-posts -->
<div class="col-md-3 col-sm-12 col-xs-12 evo-small-list">
<article class="evo-post post evo-cat-color '. $title_hover_style .' evo-image-filter '. $image_hover_style .'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
}
elseif ($i == 4) {
$output .= '
<article class="evo-post post evo-cat-color '. $title_hover_style .' evo-image-filter '. $image_hover_style .'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
</div><!-- evo-lr-small -->
';
}
$i++; endwhile; // end of the loop.
wp_reset_postdata();
$output .= '
</div><!-- row -->
</div><!-- evo-module -->
';
return $output;
}
elseif ($atts["style"] == "style3") {
$query = wp_parse_args(
array(
'posts_per_page' => '5',
)
, $query );
$output .='
<div class="evo-module evo-cat-module-c evo-full '.$margin_top .'">';
if (!empty($atts['subcategory_title'])) {
$output .='<div class="evo-module-title border-decor center style-b"><h4 class="evo-title">'.$atts['subcategory_title'].'</h4></div>';
}
$output .='
<div class="evo-border-decor top"><span></span></div>
<div class="evo-modulle-inner evo-row">
';
$posts = new WP_Query( $query );
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post();
//Category Color
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
if ($i == 0) {
$output .='<div class="col-md-3 col-sm-12 col-xs-12 evo-small-list">';
}
if ($i == 0 || $i == 1) {
$output .='
<article class="evo-post post evo-cat-color '. $title_hover_style .' evo-image-filter '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->';
}
if ($i == 1) {
$output .='
</div><!-- evo-cat-small-list -->
';
}
if ($i == 2) {
$output .='
<div class="col-md-6 col-sm-12 col-xs-12 evo-post-center">
';
}
if ($i == 2) {
$output .='
<article class="evo-post post post-overlay" itemscope="itemscope" itemtype="http://schema.org/Article" style="background-image: url('.garage_post_image_url('garage_image_four').');">
<div class="evo-overlay-wrap">
<div class="evo-overlay-inner">
<div class="evo-decor-border-top"></div>
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
<div class="evo-decor-border-bottom"></div>
</div><!-- evo-overlay-inner -->
</div><!-- evo-overlay-wrap -->
<a href="'.get_the_permalink().'" class="evo-overlay-link" tabindex="0"></a>
</article><!-- evo-post -->
';
}
if ($i == 2) {
$output .='
</div>
';
}
if ($i == 3) {
$output .='<div class="col-md-3 col-sm-12 col-xs-12 evo-small-list">';
}
if ($i == 3 || $i == 4) {
$output .='
<article class="evo-post post evo-cat-color '. $title_hover_style .' evo-image-filter '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
}
if ($i == 4) {
$output .='
</div><!-- evo-cat-small-list -->
';
}
$i++; endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-modulle-inner -->
<div class="evo-border-decor bottom"><span></span></div>
</div><!-- evo-module -->
';
return $output;
}
elseif ($atts["style"] == "style4") {
$output .='
<div class="evo-module evo-cat-module-d evo-full '.$margin_top .'">';
if (!empty($atts['subcategory_title'])) {
$output .='<div class="evo-module-title center style-b"><h4 class="evo-title">'.$atts['subcategory_title'].'</h4></div>';
}
$output .='
<div class="evo-modulle-inner">
<ul class="evo-slider"
data-arrows="true"
data-dots="false"
data-speed="1000"
data-autoplay="false"
data-autospeed="2000"
data-evofade="true"
data-item="1"
data-slidetoitem="1"
data-rtl="'.$rtl_settings.'">';
$posts = new WP_Query( $query );
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post();
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<li>
<article class="evo-post post evo-cat-color '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_eight').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
'.garage_post_category().'
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['category_post_featured_settings'], 'post-excerpt')) {
$output .= garage_post_excerpt(get_the_excerpt(), '15');
}
$output .= '
</div><!-- evo-entry-content -->
<div class="evo-read-more">
'.garage_post_continue(esc_html__('Read More', 'garage')).'
</div><!-- evo-read-more -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
</li>
';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</ul>
</div><!-- evo-modulle-inner -->
</div><!-- evo-module -->
';
return $output;
}
elseif ($atts["style"] == "style5") {
$output .='
<div class="evo-module evo-cat-module-f '.$margin_top .'">';
$query = wp_parse_args(
array(
'posts_per_page' => '3',
)
, $query );
if (!empty($atts['subcategory_title'])) {
$output .='<div class="evo-module-title style-b"><h4 class="evo-title">'.$atts['subcategory_title'].'</h4></div>';
}
$posts = new WP_Query( $query );
$i = 1;
while ( $posts->have_posts() ) : $posts->the_post();
//Category Color
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
$general_color = ot_get_option('general_color');
if (!empty($category_color)) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
if ($i == 1) {
$output .='
<div class="evo-modulle-inner evo-row">
<div class="col-md-8 col-sm-12 col-xs-12 evo-post-center">
';
}
if ($i == 1) {
$output .='
<article class="evo-post post post-overlay" itemscope="itemscope" itemtype="http://schema.org/Article" style="background-image: url('.garage_post_image_url('garage_image_four').');">
<div class="evo-overlay-wrap">
<div class="evo-overlay-inner">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- evo-overlay-inner -->
</div><!-- evo-overlay-wrap -->
<a href="'.get_the_permalink().'" class="evo-overlay-link" tabindex="0"></a>
</article><!-- evo-post -->';
}
if ($i == 1) {
$output .='
</div>';
}
if ($i == 1) {
$output .='
<div class="col-md-4 col-sm-12 col-xs-12 evo-small-list">
';
}
if ($i == 2 || $i == 3) {
$output .='
<article class="evo-post post evo-cat-color '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
}
if ($i == 3) {
$output .='
</div>';
}
$i++; endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-modulle-inner -->
</div><!-- evo-module -->
';
return $output;
}
elseif ($atts["style"] == "style6") {
$query = wp_parse_args(
array(
'posts_per_page' => '2',
)
, $query );
$output .='<div class="evo-module evo-cat-module-g '.$margin_top .'">';
if (!empty($atts['subcategory_title'])) {
$output .='<div class="evo-module-title style-b"><h4 class="evo-title">'.$atts['subcategory_title'].'</h4></div>';
}
$output .='<div class="evo-modulle-inner">';
$posts = new WP_Query( $query );
$i = 1;
while ( $posts->have_posts() ) : $posts->the_post();
//Category Color
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
$general_color = ot_get_option('general_color');
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
if ($i == 1) {
$output .='
<article class="evo-post post evo-cat-color '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_excerpt(get_the_excerpt(), '11');
}
$output .= '
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
}
else{
$output .='
<article class="evo-post post evo-cat-color '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_excerpt(get_the_excerpt(), '11');
}
$output .= '
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->';
}
$i++; endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-modulle-inner -->
</div><!-- evo-module -->
';
return $output;
}
if ($atts["style"] == "style8") {
$query = wp_parse_args(
array(
'posts_per_page' => '3',
)
, $query );
$output.='
<div class="evo-module evo-cat-module-a evo-column-3 evo-full '.$margin_top .'">';
if (!empty($atts['subcategory_title'])) {
$output .='<div class="evo-module-title center style-b"><h4 class="evo-title">'.$atts['subcategory_title'].'</h4></div>';
}
$output .='
<div class="evo-modulle-inner evo-row evo-flex">';
$posts = new WP_Query( $query );
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post();
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<article class="evo-post post evo-post-header-top evo-cat-color evo-cat-line '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_five').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
<div class="evo-post-meta top">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_category();
}
$output .='
</div><!-- evo-post-meta -->
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['category_post_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['category_post_featured_settings'], 'post-excerpt')) {
$output .= garage_post_excerpt(get_the_excerpt(), '13');
}
$output .= '
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-modulle-inner -->
</div><!-- evo-module -->
';
return $output;
}
else{
$query = wp_parse_args(
array(
'posts_per_page' => '3',
)
, $query );
$output .='
<div class="evo-module evo-cat-module-e '.$margin_top .'">';
if (!empty($atts['subcategory_title'])) {
$output .='<div class="evo-module-title center style-b"><h4 class="evo-title">'.$atts['subcategory_title'].'</h4></div>';
}
$output .='
<div class="evo-modulle-inner evo-post-center">';
$posts = new WP_Query( $query );
$i = 1;
while ( $posts->have_posts() ) : $posts->the_post();
$output .='
<article class="evo-post post post-overlay" itemscope="itemscope" itemtype="http://schema.org/Article" style="background-image: url('.garage_post_image_url('garage_image_four').');">
<div class="evo-overlay-wrap">
<div class="evo-overlay-inner">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta">';
if (!strstr($atts['category_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['category_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- evo-overlay-inner -->
</div><!-- evo-overlay-wrap -->
<a href="'.get_the_permalink().'" class="evo-overlay-link" tabindex="0"></a>
</article><!-- evo-post -->
';
$i++; endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-modulle-inner -->
</div><!-- evo-module -->';
return $output;
}
}
add_shortcode("evo_category_post", "evo_category_post");
/******************************************* CAROUSEL POST START *******************************************/
if(function_exists('vc_map')){
$posts_list = get_posts(array(
'orderby' => 'title',
'order' => 'ASC',
'post_type' => 'post'
));
vc_map( array(
"name" => esc_html__("Carousel Posts", 'garage'),
"base" => "evo_carousel_post",
"class" => "",
"category" => esc_html__("Garage Theme", 'garage'),
"icon" => get_template_directory_uri().'/includes/evo_admin/assets/images/vc_icon/evo_carousel_post.png',
"description" =>esc_html__( 'Carousel posts widget.','garage'),
"params" => array(
//Featured Style
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Style",'garage'),
"description" => esc_html__("Select the design element.",'garage'),
"param_name" => "style",
"value" => array(
esc_html__("Style 1", 'garage') => "style1",
esc_html__("Style 2", 'garage') => "style2",
esc_html__("Style 3", 'garage') => "style3",
)
),
//Style 1
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Select Design",'garage'),
"param_name" => "carousel_style_1",
"value" => array(
esc_html__("2 Grid", 'garage') => "style1",
esc_html__("4 Grid", 'garage') => 'style2',
),
"description" => sprintf(esc_html__("You can choose to have %s of this design.",'garage'),"<code>2 different style</code>"),
'dependency' => Array('element' => "style", 'value' => array('style1')),
),
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'style_one_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/carousel/style_1_1.jpg',
'dependency' => Array('element' => "carousel_style_1", 'value' => array('style1'))
),
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'style_one_two_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/carousel/style_1_2.jpg',
'dependency' => Array('element' => "carousel_style_1", 'value' => array('style2'))
),
//Style 2
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Select Design",'garage'),
"param_name" => "category_style_2",
"value" => array(
esc_html__("2 Grid", 'garage') => "style1",
esc_html__("3 Grid", 'garage') => 'style2',
),
"description" => sprintf(esc_html__("You can choose to have %s of this design.",'garage'),"<code>2 different style</code>"),
'dependency' => Array('element' => "style", 'value' => array('style2')),
),
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'style_two_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/carousel/style_2_1.jpg',
'dependency' => Array('element' => "category_style_2", 'value' => array('style1'))
),
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'style_two_two_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/carousel/style_2_2.jpg',
'dependency' => Array('element' => "category_style_2", 'value' => array('style2'))
),
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Select Light & Dark",'garage'),
"param_name" => "category_style_2_dark_light",
"value" => array(
esc_html__("Light", 'garage') => 'light',
esc_html__("Dark", 'garage') => 'dark',
),
'dependency' => Array('element' => "style", 'value' => array('style2')),
),
//Style 3
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'stylethereeimage',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/carousel/style_3.jpg',
'dependency' => Array('element' => "style", 'value' => array('style3'))
),
//Title
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Carousel Title', 'garage'),
"description" => esc_html__('Enter Carousel Title. If you want, you can leave this blank', 'garage'),
"param_name" => "carousel_title",
"value" => "",
),
//Margin On / Off
array(
'type' => 'dropdown',
'class' => '',
'heading' => esc_html__('Margin top on or off','garage'),
'description' => esc_html__('Margin top on or off','garage'),
'param_name' => 'margin_top',
'value' => array(
esc_html__('On', 'garage') => 'module-margin-top',
esc_html__('Off', 'garage') => '',
)
),
//Featured Settings
array(
"type" => "checkbox",
"class" => "",
"heading" => esc_html__("Featured Design Settings",'garage'),
"description" => sprintf(esc_html__("From here you can make design settings for featured. Autoplay, Title, Border, Arrow settings. %s",'garage'), '<code>Check the carousel you want to turn off.</code>'),
"param_name" => "carousel_post_design_settings",
"value" => array(
esc_html__("Autoplay", 'garage') => "autoplay",
esc_html__("Arrow", 'garage') => "arrow",
esc_html__("Dots", 'garage') => "dots",
),
),
//Design Settings
array(
"type" => "checkbox",
"class" => "",
"heading" => esc_html__("Design Settings",'garage'),
"description" => sprintf(esc_html__("You can close and open areas in the design Author, Date, and Title. %s",'garage'), '<code>Check the carousel you want to turn off.</code>'),
"param_name" => "carousel_post_featured_settings",
"value" => array(
esc_html__("Post Title", 'garage') => "post-title",
esc_html__("Post Author", 'garage') => "post-author",
esc_html__("Post Date", 'garage') => "post-date",
esc_html__("Post Excerpt", 'garage') => "post-excerpt",
),
),
/******************************************* FILTER START *******************************************/
//Pos Order By
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Post Order By",'garage'),
"description" => esc_html__("Post Order By",'garage'),
"param_name" => "order_by",
'group' => esc_html__( 'Query', 'garage' ),
"value" => array(
esc_html__("None Select", 'garage') => "none-select",
esc_html__("Date", 'garage') => 'date',
esc_html__("Random", 'garage') => 'rand',
esc_html__("Most Popular Post", 'garage') => 'meta_value_num',
esc_html__("Comment Count", 'garage') => 'comment_count',
)
),
//Post Count
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Post Count', 'garage'),
"description" => esc_html__('Enter Post Count', 'garage'),
'group' => esc_html__( 'Query', 'garage' ),
"param_name" => "post_count",
"value" => "",
),
//Exclude Post
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Posts",'garage'),
"description" => sprintf(esc_html__("Enter exclude posts id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
'group' => esc_html__( 'Query', 'garage' ),
"param_name" => "exclude_postid",
"value" => "",
),
//Exclude Category
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Category",'garage'),
"description" => sprintf(esc_html__("Enter exclude category id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "exclude_category",
'group' => esc_html__( 'Query', 'garage' ),
"value" => "",
),
//Exclude Tag
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Tags",'garage'),
"description" => sprintf(esc_html__("Enter exclude tag id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "exclude_tag",
'group' => esc_html__( 'Query', 'garage' ),
"value" => "",
),
//Posts Source
array(
"type" => "dropdown",
"heading" => "Post Source",
"param_name" => "query_source",
'group' => esc_html__( 'Query', 'garage' ),
"value" => array(
'Post ID' => "post-id",
'By Category' => "by-category",
'By Author' => "by-author",
),
"std" => "post-id",
"description" => "Select a query for posts you want to show"
),
//Post ID
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Post ID', 'garage'),
"description" => sprintf(esc_html__("Enter Post id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "postid",
"value" => "",
'group' => esc_html__( 'Query', 'garage' ),
"dependency" => Array('element' => "query_source", 'value' => array('post-id'))
),
//By Category Select
array(
"type" => "dropdown",
"heading" => "Post Categories",
"param_name" => "cat",
"value" => evo_visual_composer_category(),
'group' => esc_html__( 'Query', 'garage' ),
"description" => "Select category",
"dependency" => Array('element' => "query_source", 'value' => array('by-category'))
),
//Authot ID Select
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Author ID's",'garage'),
"description" => sprintf(esc_html__("Enter Author id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "author_id",
"value" => "",
'group' => esc_html__( 'Query', 'garage' ),
"dependency" => Array('element' => "query_source", 'value' => array('by-author'))
),
/******************************************* FILTER END *******************************************/
)
));
}
function evo_carousel_post( $atts, $content = null ) {
$atts = vc_map_get_attributes( 'evo_carousel_post', $atts );
extract( $atts );
$image_hover_style = ot_get_option('image_hover_color');
$title_hover_style = ot_get_option('title_hover_style');
$general_color = ot_get_option('general_color');
$atts = shortcode_atts(
array(
"style" => "",
"carousel_title" => "",
"carousel_style_1" => "",
"category_style_2" => "",
"category_style_2_dark_light" => "",
"carousel_post_design_settings" => "",
"carousel_post_featured_settings" => "",
"order_by" => "",
"post_count" => "",
"exclude_postid" => "",
"exclude_category" => "",
"exclude_tag" => "",
"query_source" => "",
"postid" => "",
"cat" => "",
"author_id" => "",
"margin_top" => "",
), $atts
);
$output = '';
/*------------- postid -------------*/
if( !empty( $atts['postid'] ) ) :
$postid = $atts['postid'];
$postid = explode( ',', $postid );
else:
$postid = "";
endif;
/*------------- author_id -------------*/
if( !empty( $atts['author_id'] ) ) :
$author_id = $atts['author_id'];
$author_id = explode( ',', $author_id );
else:
$author_id = "";
endif;
/*------------- exclude_postid -------------*/
if( !empty( $atts['exclude_postid'] ) ) :
$exclude_postid = $atts['exclude_postid'];
$exclude_postid = explode( ',', $exclude_postid );
else:
$exclude_postid = "";
endif;
/*------------- featured_exclude_category -------------*/
if( !empty( $atts['exclude_category'] ) ) :
$exclude_category = $atts['exclude_category'];
$exclude_category = explode( ',', $exclude_category );
else:
$exclude_category = "";
endif;
/*------------- exclude_tag -------------*/
if( !empty( $atts['exclude_tag'] ) ) :
$exclude_tag = $atts['exclude_tag'];
$exclude_tag = explode( ',', $exclude_tag );
else:
$exclude_tag = "";
endif;
/*------------- Rtl -------------*/
if (ot_get_option('evo_rtl_settings')=='on') {
$rtl_settings = 'true';
}
else{
$rtl_settings = 'false';
}
/*------------- Query Start -------------*/
$query = array(
'post__in' => $postid,
'author__in' => $author_id,
'post_status' => 'publish',
'posts_per_page' => $atts['post_count'],
'orderby' => $atts['order_by'],
'cat' => $atts['cat'],
'post__not_in' => $exclude_postid,
'category__not_in' => $exclude_category,
'tag__not_in' => $exclude_tag,
'ignore_sticky_posts' => true,
'post_type' => 'post'
);
if ($atts['order_by']=='meta_value_num') {
$query = wp_parse_args(
array(
'meta_key' => 'post_views_count',
'orderby' => $atts['order_by'],
)
, $query );
}
else {
$query = wp_parse_args(
array(
'meta_key' => '',
'orderby' => $atts['order_by'],
)
, $query );
}
//AUTOPLAY
if (strstr($atts['carousel_post_design_settings'], 'autoplay')) {
$evo_carousel_autoplay_on_off = 'true';
}
else{
$evo_carousel_autoplay_on_off = 'false';
}
//ARROWS
if (strstr($atts['carousel_post_design_settings'], 'arrow')) {
$evo_carousel_arrow_on_off = 'true';
$evo_carousel_arrow_class = 'arrows-active';
}
else{
$evo_carousel_arrow_on_off = 'false';
$evo_carousel_arrow_class = '';
}
//DOTS
if (strstr($atts['carousel_post_design_settings'], 'dots')) {
$evo_carousel_dots_on_off = 'true';
}
else{
$evo_carousel_dots_on_off = 'false';
}
//RTL
if (is_rtl()) {
$rtl_settings = 'true';
}
else{
$rtl_settings = 'false';
}
//Carousel Style 2 Dark & Light
if ($atts['category_style_2_dark_light']=='dark') {
$carousel_dark_light = 'dark';
}
else{
$carousel_dark_light = 'light';
}
//EVO TITLE STYLE
$title_style = ot_get_option('evo_title_style');
$margin_top = $atts['margin_top'];
/*------------- Style 1 -------------*/
if ($atts["style"] == "style1") {
if ($atts['carousel_style_1']=='style1') {
$output .='
<div class="evo-module evo-carousel-a evo-full '.$margin_top.'">';
if (!empty($atts['carousel_title'])) {
$output .='
<div class="evo-module-title style-b">
<h4 class="evo-title">'.$atts['carousel_title'].'</h4>
</div>
';
}
$output .='
<div class="evo-modulle-inner">
<div class="evo-slider"
data-arrows="'.$evo_carousel_arrow_on_off.'"
data-dots="'.$evo_carousel_dots_on_off.'"
data-speed="1000"
data-autoplay="'.$evo_carousel_autoplay_on_off.'"
data-autospeed="2000"
data-evofade="false"
data-item="2"
data-slidetoitem="1"
data-rtl="'.$rtl_settings.'">';
$posts = new WP_Query( $query );
while ( $posts->have_posts() ) : $posts->the_post();
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<article class="evo-post post evo-cat-color evo-title-hover '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['carousel_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['carousel_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['carousel_post_featured_settings'], 'post-excerpt')) {
$output .= garage_post_excerpt(get_the_excerpt(), '20');
}
$output .= '
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-slider -->
</div><!-- evo-modulle-inner -->
</div><!-- evo-module -->
';
return $output;
}
else{
$output .='
<div class="evo-module evo-carousel-a evo-full '.$margin_top.'">';
if (!empty($atts['carousel_title'])) {
$output .='
<div class="evo-module-title center style-b">
<h4 class="evo-title">'.$atts['carousel_title'].'</h4>
</div>
';
}
$output .='
<div class="evo-modulle-inner">
<div class="evo-slider"
data-arrows="'.$evo_carousel_arrow_on_off.'"
data-dots="'.$evo_carousel_dots_on_off.'"
data-speed="1000"
data-autoplay="'.$evo_carousel_autoplay_on_off.'"
data-autospeed="2000"
data-evofade="false"
data-item="4"
data-slidetoitem="1"
data-rtl="'.$rtl_settings.'">';
$posts = new WP_Query( $query );
while ( $posts->have_posts() ) : $posts->the_post();
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<article class="evo-post post evo-cat-color evo-title-hover '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">';
if (!strstr($atts['carousel_post_featured_settings'], 'post-title')) {
$output .= garage_post_title('h3', 'evo-entry-title', true);
}
$output .= '
<div class="evo-post-meta bottom">';
if (!strstr($atts['carousel_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['carousel_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['carousel_post_featured_settings'], 'post-excerpt')) {
$output .= garage_post_excerpt(get_the_excerpt(), '9');
}
$output .= '
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-slider -->
</div><!-- evo-modulle-inner -->
</div><!-- evo-module -->
';
return $output;
}
}
/*------------- Style 1 -------------*/
elseif ($atts["style"] == "style2") {
if ($atts['category_style_2']=='style1') {
$output .='
<div class="evo-module evo-carousel-b '.$carousel_dark_light.' evo-full '.$margin_top.'">';
if (!empty($atts['carousel_title'])) {
$output .='
<div class="evo-module-title style-b">
<h4 class="evo-title">'.$atts['carousel_title'].'</h4>
</div>
';
}
$output .='
<div class="evo-modulle-inner">
<div class="evo-slider evo-post-center"
data-arrows="'.$evo_carousel_arrow_on_off.'"
data-dots="'.$evo_carousel_dots_on_off.'"
data-speed="1000"
data-autoplay="'.$evo_carousel_autoplay_on_off.'"
data-autospeed="2000"
data-item="2"
data-slidetoitem="1"
data-rtl="'.$rtl_settings.'">';
$posts = new WP_Query( $query );
while ( $posts->have_posts() ) : $posts->the_post();
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<article class="evo-post post post-overlay" itemscope="itemscope" itemtype="http://schema.org/Article" style="background-image: url('.garage_post_image_url('garage_image_four').');">
<div class="evo-overlay-wrap">
<div class="evo-overlay-inner">';
if (!strstr($atts['carousel_post_featured_settings'], 'post-author')) {
$output .= garage_post_title('h3', 'evo-entry-title', true);
}
$output .='
<div class="evo-post-meta">';
if (!strstr($atts['carousel_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['carousel_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- evo-overlay-inner -->
</div><!-- evo-overlay-wrap -->
<a href="'.get_the_permalink().'" class="evo-overlay-link" tabindex="0"></a>
</article><!-- evo-post -->';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-slider -->
</div><!-- evo-modulle-inner -->
</div><!-- evo-module -->
';
return $output;
}
else{
$output .='
<div class="evo-module evo-carousel-b '.$carousel_dark_light.' evo-full '.$margin_top.'">
<div class="container">';
if (!empty($atts['carousel_title'])) {
$output .='
<div class="evo-module-title center style-b">
<h4 class="evo-title">'.$atts['carousel_title'].'</h4>
</div>
';
}
$output .='
<div class="evo-modulle-inner">
<div class="evo-slider evo-post-center"
data-arrows="'.$evo_carousel_arrow_on_off.'"
data-dots="'.$evo_carousel_dots_on_off.'"
data-speed="1000"
data-autoplay="'.$evo_carousel_autoplay_on_off.'"
data-autospeed="2000"
data-item="3"
data-slidetoitem="1"
data-rtl="'.$rtl_settings.'">';
$posts = new WP_Query( $query );
while ( $posts->have_posts() ) : $posts->the_post();
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<article class="evo-post post post-overlay" itemscope="itemscope" itemtype="http://schema.org/Article" style="background-image: url('.garage_post_image_url('garage_image_four').');">
<div class="evo-overlay-wrap">
<div class="evo-overlay-inner">';
if (!strstr($atts['carousel_post_featured_settings'], 'post-author')) {
$output .= garage_post_title('h3', 'evo-entry-title', true);
}
$output .='
<div class="evo-post-meta">';
if (!strstr($atts['carousel_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['carousel_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- evo-overlay-inner -->
</div><!-- evo-overlay-wrap -->
<a href="'.get_the_permalink().'" class="evo-overlay-link" tabindex="0"></a>
</article><!-- evo-post -->';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-slider -->
</div><!-- evo-modulle-inner -->
</div><!-- container -->
</div><!-- evo-module -->
';
return $output;
}
}
else{
$output .='
<div class="evo-module evo-carousel-b light evo-full '.$margin_top.'">';
if (!empty($atts['carousel_title'])) {
$output .='
<div class="evo-module-title style-b">
<h4 class="evo-title">'.$atts['carousel_title'].'</h4>
</div>
';
}
$output .='
<div class="evo-modulle-inner">
<div class="evo-slider evo-post-center"
data-arrows="'.$evo_carousel_arrow_on_off.'"
data-dots="'.$evo_carousel_dots_on_off.'"
data-speed="1000"
data-autoplay="'.$evo_carousel_autoplay_on_off.'"
data-autospeed="2000"
data-item="1"
data-slidetoitem="1"
data-rtl="'.$rtl_settings.'">';
$posts = new WP_Query( $query );
while ( $posts->have_posts() ) : $posts->the_post();
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<article class="evo-post post post-overlay" itemscope="itemscope" itemtype="http://schema.org/Article" style="background-image: url('.garage_post_image_url('garage_image_four').');">
<div class="evo-overlay-wrap">
<div class="evo-overlay-inner">';
if (!strstr($atts['carousel_post_featured_settings'], 'post-author')) {
$output .= garage_post_title('h3', 'evo-entry-title', true);
}
$output .='
<div class="evo-post-meta">';
if (!strstr($atts['carousel_post_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['carousel_post_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- evo-overlay-inner -->
</div><!-- evo-overlay-wrap -->
<a href="'.get_the_permalink().'" class="evo-overlay-link" tabindex="0"></a>
</article><!-- evo-post -->';
endwhile; // end of the loop.
wp_reset_postdata();
$output .='
</div><!-- evo-slider -->
</div><!-- evo-modulle-inner -->
</div><!-- evo-module -->
';
return $output;
}
}
add_shortcode("evo_carousel_post", "evo_carousel_post");
/******************************************* INSTAGRAM START *******************************************/
if(function_exists('vc_map')){
vc_map( array(
"name" => esc_html__("Instagram", 'garage'),
"base" => "evo_instagram",
"class" => "",
"category" => esc_html__("Garage Theme", 'garage'),
"icon" => get_template_directory_uri().'/includes/evo_admin/assets/images/vc_icon/evo_instagram.png',
"description" =>esc_html__( 'Instagram profile images widget.','garage'),
"params" => array(
//Newsletter Style
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Style",'garage'),
"description" => esc_html__("Select the design element.",'garage'),
"param_name" => "style",
"value" => array(
esc_html__("None Style", 'garage') => "none",
esc_html__("Ten Column", 'garage') => "column-10",
esc_html__("Eight Column", 'garage') => "column-8",
esc_html__("Six Column", 'garage') => "column-6",
)
),
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Instagram User Name",'garage'),
"description" => esc_html__("Instagram User Name.",'garage'),
"param_name" => "username",
),
)
) );
}
function evo_instagram_shortcode( $atts, $content = null ) {
$atts = shortcode_atts(
array(
'style' => '',
'username' => '',
), $atts );
if ($atts['style']=='column-10') {
$slice = 10;
}
elseif ($atts['style']=='column-8') {
$slice = 8;
}
elseif ($atts['style']=='column-6') {
$slice = 6;
}
else{
$slice = 6;
}
$username = $atts['username'];
$theflow_data = scrape_instagram( $atts['username']);
$media_arry = array_slice($theflow_data, 0, $slice);
$output = '';
$output .= '
<div class="evo-module evo-instagram-module '.$atts['style'].'">
<div class="evo-module-inner">
';
$output .= '<ul>';
foreach ( $media_arry as $k => $v ):
$output .='<li>
<a href="'.esc_url($v['link']).'" target="_blank" rel="nofollow">
<img src="'.esc_url($v['thumbnail']).'" class="trs" alt="image" />
</a>
</li>';
endforeach;
$output .= '</ul>';
$output .= '
</div><!-- evo-module-inner -->
</div><!-- evo-module evo-instagram-module -->';
return $output;
}
add_shortcode("evo_instagram", "evo_instagram_shortcode");
/******************************************* VIDEO POST START *******************************************/
if(function_exists('vc_map')){
vc_map( array(
"name" => esc_html__("Video Posts", 'garage'),
"base" => "evo_video_post",
"class" => "",
"category" => esc_html__("Garage Theme", 'garage'),
"icon" => get_template_directory_uri().'/includes/evo_admin/assets/images/vc_icon/evo_video_post.png',
"description" =>esc_html__( 'Video Posts.','garage'),
"params" => array(
//Featured Style
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Style",'garage'),
"description" => esc_html__("Select the design element.",'garage'),
"param_name" => "style",
"value" => array(
esc_html__("Style 1", 'garage') => "style1",
)
),
//Style 1
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'video_style_one_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/video/style_1.jpg',
'dependency' => Array('element' => "style", 'value' => array('style1'))
),
//Margin On / Off
array(
'type' => 'dropdown',
'class' => '',
'heading' => esc_html__('Margin top on or off','garage'),
'description' => esc_html__('Margin top on or off','garage'),
'param_name' => 'margin_top',
'value' => array(
esc_html__('On', 'garage') => 'module-margin-top',
esc_html__('Off', 'garage') => '',
)
),
//Title
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Title', 'garage'),
"description" => esc_html__('Enter Title.', 'garage'),
"param_name" => "video_title",
"value" => "",
),
//Sub Title
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Sub Title', 'garage'),
"description" => esc_html__('Enter Sub Title.', 'garage'),
"param_name" => "video_sub_title",
"value" => "",
),
//Bg Title
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('BG Title', 'garage'),
"description" => esc_html__('Enter Bg Title.', 'garage'),
"param_name" => "video_bg_title",
"value" => "",
),
//Feature Setting
array(
"type" => "checkbox",
"class" => "",
"heading" => esc_html__("Slider Settings",'garage'),
"description" => sprintf(esc_html__("From here you can make design settings for featured. Autoplay, Arrow settings. %s",'garage'), '<code>Check the carousel you want to turn off.</code>'),
"param_name" => "video_post_design_settings",
"value" => array(
esc_html__("Autoplay", 'garage') => "autoplay",
esc_html__("Dots", 'garage') => "dots",
esc_html__("Arrow", 'garage') => "arrow",
),
'dependency' => Array('element' => "style", 'value' => array('style1'))
),
/******************************************* FILTER START *******************************************/
//Pos Order By
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Post Order By",'garage'),
"description" => esc_html__("Post Order By",'garage'),
"param_name" => "order_by",
'group' => esc_html__( 'Query', 'garage' ),
"value" => array(
esc_html__("None Select", 'garage') => "none-select",
esc_html__("Date", 'garage') => 'date',
esc_html__("Random", 'garage') => 'rand',
esc_html__("Most Popular Post", 'garage') => 'meta_value_num',
esc_html__("Comment Count", 'garage') => 'comment_count',
)
),
//Post Count
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Post Count', 'garage'),
"description" => esc_html__('Enter Post Count', 'garage'),
'group' => esc_html__( 'Query', 'garage' ),
"param_name" => "post_count",
"value" => "",
),
//Exclude Post
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Posts",'garage'),
"description" => sprintf(esc_html__("Enter exclude posts id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
'group' => esc_html__( 'Query', 'garage' ),
"param_name" => "exclude_postid",
"value" => "",
),
//Exclude Category
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Category",'garage'),
"description" => sprintf(esc_html__("Enter exclude category id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "exclude_category",
'group' => esc_html__( 'Query', 'garage' ),
"value" => "",
),
//Exclude Tag
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Tags",'garage'),
"description" => sprintf(esc_html__("Enter exclude tag id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "exclude_tag",
'group' => esc_html__( 'Query', 'garage' ),
"value" => "",
),
//Posts Source
array(
"type" => "dropdown",
"heading" => "Post Source",
"param_name" => "query_source",
'group' => esc_html__( 'Query', 'garage' ),
"value" => array(
'Post ID' => "post-id",
'By Category' => "by-category",
'By Author' => "by-author",
),
"std" => "post-id",
"description" => "Select a query for posts you want to show"
),
//Post ID
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Post ID', 'garage'),
"description" => sprintf(esc_html__("Enter Post id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "postid",
"value" => "",
'group' => esc_html__( 'Query', 'garage' ),
"dependency" => Array('element' => "query_source", 'value' => array('post-id'))
),
//By Category Select
array(
"type" => "dropdown",
"heading" => "Post Categories",
"param_name" => "cat",
"value" => evo_visual_composer_category(),
'group' => esc_html__( 'Query', 'garage' ),
"description" => "Select category",
"dependency" => Array('element' => "query_source", 'value' => array('by-category'))
),
//Authot ID Select
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Author ID's",'garage'),
"description" => sprintf(esc_html__("Enter Author id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "author_id",
"value" => "",
'group' => esc_html__( 'Query', 'garage' ),
"dependency" => Array('element' => "query_source", 'value' => array('by-author'))
),
/******************************************* FILTER END *******************************************/
)
));
}
function evo_video_post( $atts, $content = null ) {
$atts = vc_map_get_attributes( 'evo_video_post', $atts );
extract( $atts );
$general_color = ot_get_option('general_color');
$atts = shortcode_atts(
array(
"style" => "",
"video_widget_dark_light" => "",
"video_title" => "",
"video_sub_title" => "",
"video_bg_title" => "",
"video_post_design_settings" => "",
"video_post_featured_settings" => "",
"order_by" => "",
"post_count" => "",
"exclude_postid" => "",
"exclude_category" => "",
"exclude_tag" => "",
"query_source" => "",
"postid" => "",
"cat" => "",
"author_id" => "",
"margin_top" => "",
), $atts
);
$output = '';
/*------------- postid -------------*/
if( !empty( $atts['postid'] ) ) :
$postid = $atts['postid'];
$postid = explode( ',', $postid );
else:
$postid = "";
endif;
/*------------- author_id -------------*/
if( !empty( $atts['author_id'] ) ) :
$author_id = $atts['author_id'];
$author_id = explode( ',', $author_id );
else:
$author_id = "";
endif;
/*------------- exclude_postid -------------*/
if( !empty( $atts['exclude_postid'] ) ) :
$exclude_postid = $atts['exclude_postid'];
$exclude_postid = explode( ',', $exclude_postid );
else:
$exclude_postid = "";
endif;
/*------------- featured_exclude_category -------------*/
if( !empty( $atts['exclude_category'] ) ) :
$exclude_category = $atts['exclude_category'];
$exclude_category = explode( ',', $exclude_category );
else:
$exclude_category = "";
endif;
/*------------- exclude_tag -------------*/
if( !empty( $atts['exclude_tag'] ) ) :
$exclude_tag = $atts['exclude_tag'];
$exclude_tag = explode( ',', $exclude_tag );
else:
$exclude_tag = "";
endif;
/*------------- Rtl -------------*/
if (ot_get_option('evo_rtl_settings')=='on') {
$rtl_settings = 'true';
}
else{
$rtl_settings = 'false';
}
$margin_top = $atts['margin_top'];
/*------------- Query Arg Start -------------*/
$query = array(
'post__in' => $postid,
'author__in' => $author_id,
'post_status' => 'publish',
'posts_per_page' => $atts['post_count'],
'orderby' => $atts['order_by'],
'cat' => $atts['cat'],
'post__not_in' => $exclude_postid,
'category__not_in' => $exclude_category,
'tag__not_in' => $exclude_tag,
'ignore_sticky_posts' => true,
'post_type' => 'post',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-video' ),
)
)
);
if ($atts['order_by']=='meta_value_num') {
$query = wp_parse_args(
array(
'meta_key' => 'post_views_count',
'orderby' => $atts['order_by'],
)
, $query );
}
else {
$query = wp_parse_args(
array(
'meta_key' => '',
'orderby' => $atts['order_by'],
)
, $query );
}
//AUTOPLAY
if (strstr($atts['video_post_design_settings'], 'autoplay')) {
$evo_carousel_autoplay_on_off = 'true';
}
else{
$evo_carousel_autoplay_on_off = 'false';
}
//DOTS
if (strstr($atts['video_post_design_settings'], 'dots')) {
$evo_carousel_dots_on_off = 'true';
}
else{
$evo_carousel_dots_on_off = 'false';
}
//ARROW
if (strstr($atts['video_post_design_settings'], 'arrow')) {
$evo_carousel_arrow_on_off = 'true';
}
else{
$evo_carousel_arrow_on_off = 'false';
}
//Margin TOP
$margin_top = $atts['margin_top'];
if (is_rtl()) {
$rtl_settings = 'true';
}
else{
$rtl_settings = 'false';
}
/*------------- Style 1 -------------*/
if ($atts["style"] == "style1") {
$output .='
<div class="evo-module evo-video-module evo-full '.$margin_top.'">
<div class="container">
<div class="evo-module-title center">';
if (!empty($atts['video_title'])) {
$output .='<h4 class="evo-title">'.$atts['video_title'].'</h4>';
}
$output .='
<span>'.$atts['video_sub_title'].'</span>
</div>
<div class="evo-modulle-inner">
';
$posts = new WP_Query( $query );
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post(); $i++;
//VIDEO FEATURED
global $wp_embed;
$post_id = get_the_ID();
$embed = get_post_meta(get_the_ID(), 'evo_video_url', TRUE);
$embed_url = $wp_embed->run_shortcode('[embed]'.$embed.'[/embed]');
$video_minute = get_post_meta($post_id , 'evo_video_minutes', TRUE);
$video_subtitle = get_post_meta($post_id , 'evo_video_subtitle', TRUE);
if ($i == 1) {
$output .='
<div class="evo-video-frame">
<span>'.$atts['video_bg_title'].'</span>
<div class="evo-post-video">
<div class="evo-loading"></div>
'.$embed_url.'
</div><!-- evo-post-video -->
</div><!-- evo-video-frame -->
';
}
endwhile;
wp_reset_postdata();
$output .='
<div class="evo-video-playlist">
<div class="evo-slider evo-carousel-row text-center"
data-arrows="'.$evo_carousel_arrow_on_off.'"
data-dots="'.$evo_carousel_dots_on_off.'"
data-speed="1000"
data-autoplay="'.$evo_carousel_autoplay_on_off.'"
data-autospeed="2000"
data-evofade="false"
data-item="4"
data-slidetoitem="1"
data-rtl="'.$rtl_settings.'">';
$i = 0;
while ( $posts->have_posts() ) : $posts->the_post(); $i++;
//VIDEO FEATURED
$video_minute = get_post_meta(get_the_ID() , 'evo_video_minutes', TRUE);
$output .='
<article class="evo-post post" itemscope="itemscope" itemtype="http://schema.org/Article">
<a href="'.get_the_permalink().'" id="'.get_the_ID().'">
<figure class="evo-post-image">
<div class="evo-post-format format-video"><i class="fas fa-play"></i></div>
<div class="evo-post-video-time">'.$video_minute.'</div>
'.garage_post_image('garage_image_one').'
</figure>
</a>
</article><!-- post -->
';
endwhile;
wp_reset_postdata();
$output .='
</div><!-- evo-slider -->
</div><!-- evo-video-playlist -->';
$output .='
</div><!-- evo-modulle-inner -->
</div><!-- container -->
</div><!-- evo-module -->
';
$output .='
';
return $output;
}
}
add_shortcode("evo_video_post", "evo_video_post");
/******************************************* POST GRID START *******************************************/
if(function_exists('vc_map')){
vc_map( array(
"name" => esc_html__("Posts Grid", 'garage'),
"base" => "evo_post_grid",
"class" => "",
"category" => esc_html__("Garage Theme", 'garage'),
"icon" => get_template_directory_uri().'/includes/evo_admin/assets/images/vc_icon/evo_post_grid.png',
"description" =>esc_html__( 'Post grid widget.','garage'),
"params" => array(
//Featured Style
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Style",'garage'),
"description" => esc_html__("Select the design element.",'garage'),
"param_name" => "style",
"value" => array(
esc_html__("Style 1", 'garage') => "style1",
esc_html__("Style 2", 'garage') => "style2",
esc_html__("Style 3", 'garage') => "style3",
esc_html__("Style 4", 'garage') => "style4",
esc_html__("Style 5", 'garage') => "style5",
)
),
//Style 1
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'style_one_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/post_style/style_1.jpg',
'dependency' => Array('element' => "style", 'value' => array('style1'))
),
//Style 2
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'style_two_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/post_style/style_2.jpg',
'dependency' => Array('element' => "style", 'value' => array('style2'))
),
//Style 1
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'style_theree_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/post_style/style_4.jpg',
'dependency' => Array('element' => "style", 'value' => array('style4'))
),
//Style 1
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'style_four_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/post_style/style_3.jpg',
'dependency' => Array('element' => "style", 'value' => array('style3'))
),
//Style 1
array(
'type' => 'imagethup',
'heading' => '',
'param_name' => 'style_five_image',
'value' => get_template_directory_uri().'/includes/evo_admin/assets/images/post_style/style_5.jpg',
'dependency' => Array('element' => "style", 'value' => array('style5'))
),
//Design Settings
array(
"type" => "checkbox",
"class" => "",
"heading" => esc_html__("Design Settings",'garage'),
"description" => sprintf(esc_html__("You can close and open areas in the design Category, Share Count, Views, Like, Author, Date, Comment Count, Post Desc and Title. %s",'garage'), '<code>Check the feature you want to turn off.</code>'),
"param_name" => "post_grid_featured_settings",
"value" => array(
esc_html__("Post Category", 'garage') => "post-category",
esc_html__("Post Title", 'garage') => "post-title",
esc_html__("Post Author", 'garage') => "post-author",
esc_html__("Post Date", 'garage') => "post-date",
esc_html__("Post Comment Count", 'garage') => "post-comment",
esc_html__("Post Excerpt", 'garage') => "post-excerpt",
esc_html__("Post Continue Button", 'garage') => "post-continue",
),
),
//Title Text
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Title Text",'garage'),
"param_name" => "post_grid_title",
),
//Margin On / Off
array(
'type' => 'dropdown',
'class' => '',
'heading' => esc_html__('Margin top on or off','garage'),
'description' => esc_html__('Margin top on or off','garage'),
'param_name' => 'margin_top',
'value' => array(
esc_html__('On', 'garage') => 'module-margin-top',
esc_html__('Off', 'garage') => '',
)
),
//Pagination Style
array(
"type" => "dropdown",
"heading" => "Pagination Style",
"param_name" => "post_grid_pagination",
"value" => array(
esc_html__("None Select", 'garage') => "none",
esc_html__('Regular Pagination', 'garage') => "style1",
esc_html__('Ajax Load More', 'garage') => "style2",
esc_html__('Next Page and Prev Page', 'garage') => "style3",
esc_html__('Regular Pagination Not Ajax', 'garage') => "style4",
),
"description" => "Please select pagination style",
),
array(
"type" => "my_param_hidden",
"class" => "display-none",
"admin_label" => false,
"param_name" => "element_ajax_id",
"value"=>rand(5, 10000000),
),
/******************************************* FILTER START *******************************************/
//Pos Order By
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Post Order By",'garage'),
"description" => esc_html__("Post Order By",'garage'),
"param_name" => "order_by",
'group' => esc_html__( 'Query', 'garage' ),
"value" => array(
esc_html__("None Select", 'garage') => "none-select",
esc_html__("Date", 'garage') => 'date',
esc_html__("Random", 'garage') => 'rand',
esc_html__("Most Popular Post", 'garage') => 'meta_value_num',
esc_html__("Comment Count", 'garage') => 'comment_count',
)
),
//Post Count
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Post Count', 'garage'),
"description" => esc_html__('Enter Post Count', 'garage'),
'group' => esc_html__( 'Query', 'garage' ),
"param_name" => "post_count",
"value" => "",
),
//Exclude Post
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Posts",'garage'),
"description" => sprintf(esc_html__("Enter exclude posts id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
'group' => esc_html__( 'Query', 'garage' ),
"param_name" => "exclude_postid",
"value" => "",
),
//Exclude Category
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Category",'garage'),
"description" => sprintf(esc_html__("Enter exclude category id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "exclude_category",
'group' => esc_html__( 'Query', 'garage' ),
"value" => "",
),
//Exclude Tag
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Exclude Tags",'garage'),
"description" => sprintf(esc_html__("Enter exclude tag id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "exclude_tag",
'group' => esc_html__( 'Query', 'garage' ),
"value" => "",
),
//Posts Source
array(
"type" => "dropdown",
"heading" => "Post Source",
"param_name" => "query_source",
'group' => esc_html__( 'Query', 'garage' ),
"value" => array(
'Post ID' => "post-id",
'By Category' => "by-category",
'By Author' => "by-author",
),
"std" => "post-id",
"description" => "Select a query for posts you want to show"
),
//Post ID
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__('Post ID', 'garage'),
"description" => sprintf(esc_html__("Enter Post id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "postid",
"value" => "",
'group' => esc_html__( 'Query', 'garage' ),
"dependency" => Array('element' => "query_source", 'value' => array('post-id'))
),
//By Category Select
array(
"type" => "dropdown",
"heading" => "Post Categories",
"param_name" => "cat",
"value" => evo_visual_composer_category(),
'group' => esc_html__( 'Query', 'garage' ),
"description" => "Select category",
"dependency" => Array('element' => "query_source", 'value' => array('by-category'))
),
//Authot ID Select
array(
"type" => "textfield",
"class" => "",
"heading" => esc_html__("Author ID's",'garage'),
"description" => sprintf(esc_html__("Enter Author id. %s",'garage'),'<code>Separate with commas 1,2,3 etc.</code>'),
"param_name" => "author_id",
"value" => "",
'group' => esc_html__( 'Query', 'garage' ),
"dependency" => Array('element' => "query_source", 'value' => array('by-author'))
),
/******************************************* FILTER END *******************************************/
)
));
}
function evo_post_grid( $atts, $content = null ) {
$atts = vc_map_get_attributes( 'evo_post_grid', $atts );
extract( $atts );
$image_hover_style = ot_get_option('image_hover_color');
$title_hover_style = ot_get_option('title_hover_style');
$atts = shortcode_atts(
array(
"style" => "",
"post_style_1" => "",
"post_style_2" => "",
"post_style_4" => "",
"post_style_4_border" => "",
"post_grid_settings" => "",
"post_grid_featured_settings" => "",
"post_grid_lenght" => "",
"post_grid_pagination" => "",
"element_ajax_id" => "",
"post_grid_title" => "",
"order_by" => "",
"post_count" => "",
"exclude_postid" => "",
"exclude_category" => "",
"exclude_tag" => "",
"query_source" => "",
"postid" => "",
"cat" => "" ,
"author_id" => "",
"margin_top" => ""
), $atts
);
$output = '';
/*------------- postid -------------*/
if( !empty( $atts['postid'] ) ) :
$postid = $atts['postid'];
$postid = explode( ',', $postid );
else:
$postid = "";
endif;
/*------------- author_id -------------*/
if( !empty( $atts['author_id'] ) ) :
$author_id = $atts['author_id'];
$author_id = explode( ',', $author_id );
else:
$author_id = "";
endif;
/*------------- exclude_postid -------------*/
if( !empty( $atts['exclude_postid'] ) ) :
$exclude_postid = $atts['exclude_postid'];
$exclude_postid = explode( ',', $exclude_postid );
else:
$exclude_postid = "";
endif;
/*------------- featured_exclude_category -------------*/
if( !empty( $atts['exclude_category'] ) ) :
$exclude_category = $atts['exclude_category'];
$exclude_category = explode( ',', $exclude_category );
else:
$exclude_category = "";
endif;
/*------------- exclude_tag -------------*/
if( !empty( $atts['exclude_tag'] ) ) :
$exclude_tag = $atts['exclude_tag'];
$exclude_tag = explode( ',', $exclude_tag );
else:
$exclude_tag = "";
endif;
//EVO TITLE STYLE
$title_style = ot_get_option('evo_title_style');
$general_color = ot_get_option('general_color');
$paged = is_front_page() ? get_query_var( 'page', 1 ) : get_query_var( 'paged', 1 );
/*------------- Query Start -------------*/
$query = array(
'post__in' => $postid,
'author__in' => $author_id,
'post_status' => 'publish',
'orderby' => $atts['order_by'],
'cat' => $atts['cat'],
'posts_per_page' => $atts['post_count'],
'post__not_in' => $exclude_postid,
'category__not_in' => $exclude_category,
'tag__not_in' => $exclude_tag,
'ignore_sticky_posts' => true,
'post_type' => 'post',
'paged' => $paged
);
if ($atts['order_by']=='meta_value_num') {
$query = wp_parse_args(
array(
'meta_key' => 'post_views_count',
'orderby' => $atts['order_by'],
)
, $query );
}
else {
$query = wp_parse_args(
array(
'meta_key' => '',
'orderby' => $atts['order_by'],
)
, $query );
}
$lenght = $atts['post_grid_lenght'];
$margin_top = $atts['margin_top'];
$posts = query_posts( $query );
$index = 0;
if (have_posts()) {
if ($atts["style"] == "style1") {
$output .='<div class="evo-module evo-blog-post-b evo-column-1 '.$margin_top.'">';
}
elseif ($atts["style"] == "style2") {
$output .='<div class="evo-module evo-blog-post-a evo-column-2 '.$margin_top.'">';
}
elseif ($atts["style"] == "style3") {
$output .='<div class="evo-module evo-blog-post-c '.$margin_top.'">';
}
elseif ($atts["style"] == "style5") {
$output .='<div class="evo-module evo-blog-post-e '.$margin_top .'">';
}
else{
$output .='<div class="evo-module evo-blog-post-d evo-column-3 evo-full '.$margin_top.'">';
}
if (!empty($atts['post_grid_title'])) {
if ($atts["style"] == "style4") {
$output .='
<div class="evo-module-title center style-b"><h4 class="evo-title">'.$atts['post_grid_title'].'</h4></div>';
}
else{
$output .='
<div class="evo-module-title style-b"><h4 class="evo-title">'.$atts['post_grid_title'].'</h4></div>';
}
}
if ($atts["style"] == "style2") {
$output .='<div class="evo-modulle-inner evo-row evo-flex">';
}
if ($atts['post_grid_pagination'] == 'style1' || $atts['post_grid_pagination'] == 'style3') {
$output .= '<div class="evo-post-body-ajax-wrapper">';
$output .= '<div class="theme-ajax-pagination" id="'.$atts['element_ajax_id'].'">';
}
if ($atts['post_grid_pagination'] == 'style2') {
$output .= '<div id="more-posts-wrapper-ajax">';
$output .= '<div class="theme-ajax-pagination" id="'.$atts['element_ajax_id'].'">';
$output .= '<div class="theme-ajax-content">';
}
else{
$output .='<div class="evo-post-body">';
}
if ($atts["style"] == "style4") {
$output .='
<div class="evo-loading"></div>
<div class="evo-posts evo-row evo-flex">
';
}
else{
$output .='
<div class="evo-loading"></div>
<div class="evo-posts">
';
}
global $paged;
if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
else { $paged = 1; }
$index = 0;
while ( have_posts() ) : the_post();
/*------------- Style 1 -------------*/
if ($atts["style"] == "style1") {
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .= '
<article class="evo-post post evo-post-header-top evo-cat-color evo-cat-line '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
'.garage_post_review().'
<span></span>
'.garage_post_image('garage_image_nine').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
<div class="evo-post-meta top">';
if (!strstr($atts['post_grid_featured_settings'], 'post-category')) {
$output .= garage_post_category();
}
$output .='
</div><!-- evo-post-meta -->';
if (!strstr($atts['post_grid_featured_settings'], 'post-title')) {
$output .= garage_post_title('h3', 'evo-entry-title', true);
}
$output .= '
<div class="evo-post-meta bottom">';
if (!strstr($atts['post_grid_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['post_grid_featured_settings'], 'post-excerpt')) {
$output .= garage_post_excerpt(get_the_excerpt(), '38');
}
$output .='
</div><!-- evo-entry-content -->';
if (!strstr($atts['post_grid_featured_settings'], 'post-continue')) {
$output .= garage_post_continue(esc_html__('Read More', 'garage'));
}
$output .='
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
}
/*------------- Style 2 -------------*/
elseif ($atts["style"] == "style2") {
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<article class="evo-post post evo-post-header-top evo-cat-color evo-cat-line '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
'.garage_post_review().'
<span></span>
'.garage_post_image('garage_image_five').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
<div class="evo-post-meta top">';
if (!strstr($atts['post_grid_featured_settings'], 'post-category')) {
$output .= garage_post_category();
}
$output .='
</div><!-- evo-post-meta -->';
if (!strstr($atts['post_grid_featured_settings'], 'post-title')) {
$output .= garage_post_title('h3', 'evo-entry-title', true);
}
$output .='
<div class="evo-post-meta bottom">';
if (!strstr($atts['post_grid_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['post_grid_featured_settings'], 'post-excerpt')) {
$output .= garage_post_excerpt(get_the_excerpt(), '10');
}
$output .='
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
}
/*------------- Style 3 -------------*/
elseif ($atts["style"] == "style3") {
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<article class="evo-post post evo-cat-color '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
'.garage_post_review().'
<span></span>
'.garage_post_image('garage_image_ten').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
<div class="evo-post-meta top">';
if (!strstr($atts['post_grid_featured_settings'], 'post-category')) {
$output .= garage_post_category();
}
$output .='
</div><!-- evo-post-meta -->';
if (!strstr($atts['post_grid_featured_settings'], 'post-title')) {
$output .= garage_post_title('h3', 'evo-entry-title', true);
}
$output .='
<div class="evo-post-meta bottom">';
if (!strstr($atts['post_grid_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['post_grid_featured_settings'], 'post-excerpt')) {
$output .= garage_post_excerpt(get_the_excerpt(), '13');
}
$output .='
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
}
/*------------- Style 5 -------------*/
elseif ($atts["style"] == "style5") {
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
if ($index == 0) {
$index = 1;
$output .='
<article class="evo-post one-post post evo-cat-color '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body-inner">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['post_grid_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['post_grid_featured_settings'], 'post-comment')) {
$output .= garage_post_excerpt(get_the_excerpt(), '11');
}
$output .= '
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
}
else{
$index = 0;
$output .='
<article class="evo-post two-post post evo-cat-color '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
<span></span>
'.garage_post_image('garage_image_six').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body-inner">
<div class="evo-post-header">
'.garage_post_title('h3', 'evo-entry-title', true).'
<div class="evo-post-meta bottom">';
if (!strstr($atts['post_grid_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['post_grid_featured_settings'], 'post-comment')) {
$output .= garage_post_excerpt(get_the_excerpt(), '11');
}
$output .= '
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->';
}
}
/*------------- Style 4 -------------*/
else{
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
$category_color = get_term_meta($category_id, 'category_color', true);
if ($category_color) {
$category_color_uniq = $category_color;
}
else{
$category_color_uniq = $general_color;
}
$output .='
<article class="evo-post post evo-post-header-top evo-cat-color evo-cat-line '. $title_hover_style .' '.$image_hover_style.'" itemscope="itemscope" itemtype="http://schema.org/Article" data-catcolor="'.$category_color_uniq.'">
<figure class="evo-post-image evo-image-hover lazy-thumb">
<a href="'.get_the_permalink().'">
'.garage_post_review().'
<span></span>
'.garage_post_image('garage_image_eleven').'
</a>
</figure><!-- evo-post-image -->
<div class="evo-post-body">
<div class="evo-post-header">
<div class="evo-post-meta top">';
if (!strstr($atts['post_grid_featured_settings'], 'post-category')) {
$output .= garage_post_category();
}
$output .='
</div><!-- evo-post-meta -->';
if (!strstr($atts['post_grid_featured_settings'], 'post-title')) {
$output .= garage_post_title('h3', 'evo-entry-title', true);
}
$output .='
<div class="evo-post-meta bottom">';
if (!strstr($atts['post_grid_featured_settings'], 'post-author')) {
$output .= garage_post_author();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-date')) {
$output .= garage_post_date();
}
if (!strstr($atts['post_grid_featured_settings'], 'post-comment')) {
$output .= garage_post_comment();
}
$output .='
</div><!-- evo-post-meta -->
</div><!-- post-header -->
<div class="evo-entry-content entry-content">';
if (!strstr($atts['post_grid_featured_settings'], 'post-excerpt')) {
$output .= garage_post_excerpt(get_the_excerpt(), '13');
}
$output .='
</div><!-- evo-entry-content -->
</div><!-- evo-post-body -->
</article><!-- evo-post -->
';
}
endwhile; // end of the loop.
wp_reset_postdata();
if ($atts['post_grid_pagination'] == 'style2') {
$output .= '<div class="ajax-load-more pagination-load-more">';
$output .= get_next_posts_link(esc_html__('Load More', 'garage'),100);
$output .='</div>';
}
$output .='
</div><!-- evo-posts -->
';
if ($atts['post_grid_pagination'] == 'style1') {
$output .= '<div class="pagination">';
$output .= get_the_posts_pagination(
array(
'screen_reader_text' => esc_html__(' ', 'garage'),
'prev_text' => '«',
'next_text' => '»',
)
);
$output .= '</div>';
}
if ($atts['post_grid_pagination'] == 'style3') {
$output .= '<div class="pagination next-page">';
$output .= '<div class="prev-page">'.get_previous_posts_link().'</div>';
$output .= '<div class="next-page">'.get_next_posts_link().'</div>';
$output .= '</div>';
}
if ($atts['post_grid_pagination'] == 'style4') {
$output .= '<div class="regular pagination">';
$output .= get_the_posts_pagination(
array(
'screen_reader_text' => '',
'prev_text' => '«',
'next_text' => '»',
)
);
$output .= '</div>';
}
//Pagination
if ($atts['post_grid_pagination'] == 'style1' || $atts['post_grid_pagination'] == 'style3') {
$output .= '</div>';
$output .= '</div><!-- evo-post-body -->';
}
//Pagination
if ($atts['post_grid_pagination'] == 'style2') {
$output .= '</div>';
$output .= '</div>';
$output .= '</div><!-- evo-post-body -->';
}
else{
$output .= '</div><!-- evo-post-body -->';
}
if ($atts["style"] == "style2") {
$output .='</div>';
}
$output .='</div><!-- evo-module-posts -->';
}
wp_reset_query();
return $output;
}
add_shortcode("evo_post_grid", "evo_post_grid");
/******************************************* WIDGET AREA START *******************************************/
if(function_exists('vc_map')){
$posts_list = get_posts(array(
'orderby' => 'title',
'order' => 'ASC',
'post_type' => 'post'
));
vc_map( array(
"name" => esc_html__("Widget Sidebar", 'garage'),
"base" => "evo_widget_sidebar",
"class" => "",
"category" => esc_html__("Garage Theme", 'garage'),
"icon" => get_template_directory_uri().'/includes/evo_admin/assets/images/vc_icon/evo_widget.png',
"description" =>esc_html__( 'Widget Sidebar.','garage'),
"params" => array(
array(
"type" => "widgetised_sidebars",
"class" => "",
"heading" => esc_html__("Select Sidebar",'garage'),
"description" => esc_html__("Select Sidebar.",'garage'),
"param_name" => "sidebar_ids",
),
array(
"type" => "dropdown",
"class" => "",
"heading" => esc_html__("Sidebar Left or Right",'garage'),
"description" => esc_html__("Left or Right 30px padding.",'garage'),
"param_name" => "sidebar_sticky_leftor_light",
"value" => array(
esc_html__("None Style", 'garage') => "none",
esc_html__("Left 30px", 'garage') => "left",
esc_html__("Right 30px", 'garage') => "right",
)
),
),
));
}
function evo_widget_sidebar_shordcode( $atts, $content = null ) {
$atts = vc_map_get_attributes( 'evo_widget_sidebar', $atts );
extract( $atts );
$atts = shortcode_atts(
array(
'sidebar_ids' => '',
'sidebar_sticky_leftor_light' => '',
), $atts
);
$output = '';
$sidebarstyle = ot_get_option('sidebar_style');
$sidebar_name = $atts['sidebar_ids'];
$sidebar_sticky_leftor_light = $atts['sidebar_sticky_leftor_light'];
$output .= '
<div class="evo-sidebar '. $sidebarstyle.' '. $sidebar_sticky_leftor_light.'">';
ob_start();
dynamic_sidebar( $sidebar_name);
$output .= ob_get_contents();
ob_end_clean();
$output .= '</div><!-- sidebar -->
';
return $output;
}
add_shortcode("evo_widget_sidebar", "evo_widget_sidebar_shordcode");
/******************************************* WIDGET AREA END *******************************************/