__('WPVNUF - CPT Post List'), 'category' => __('Content'), 'priority' => 1, 'allow_in' => array('text_box'), 'options' => array( 'style' => array( 'type' => 'textarea', 'heading' => 'CSS code for this element', ), 'type' => array( 'type' => 'textfield', 'heading' => 'Kiểu hiển thị', 'default' => 'row', 'placeholder' => 'slider, row, masonery, grid', ), 'style' => array( 'type' => 'select', 'heading' => 'Phong cách', 'default' => 'default', 'options' => array( 'default' => 'default', 'bounce' => 'bounce', 'badge' => 'badge', 'push' => 'push', 'label' => 'label', 'vertical' => 'vertical', 'shade' => 'shade', 'overlay' => 'overlay', 'none' => 'none', ), ), 'show_category' => array( 'type' => 'select', 'heading' => 'Hiển thị Category label', 'default' => 'false', 'options' => array( 'false' => 'false', 'label' => 'label', 'text' => 'text', ), ), 'posts' => array( 'type' => 'textfield', 'heading' => 'Số bài viết', 'default' => '3', 'placeholder' => '3', ), 'offset' => array( 'type' => 'textfield', 'heading' => 'offset', 'default' => '0', 'placeholder' => '0', ), 'columns' => array( 'type' => 'textfield', 'heading' => 'Số cột columns', 'default' => '3', 'placeholder' => '3', ), 'text_align' => array( 'type' => 'textfield', 'heading' => 'Text align', 'default' => 'center', 'placeholder' => 'center, left, right', ), 'post_type' => array( 'type' => 'textfield', 'heading' => 'Post type', 'default' => 'post', 'placeholder' => 'post type slug', ), 'filter_by_term' => array( 'type' => 'textfield', 'heading' => 'Term slug for filter', 'default' => 'category', 'placeholder' => 'Term slug for filter', ), 'filter_by_term_value' => array( 'type' => 'textfield', 'heading' => 'Value of term for filter', 'default' => '', 'placeholder' => 'Term value for filter', ), 'image_width' => array( 'type' => 'textfield', 'heading' => 'Image Width', 'default' => '100%', ), 'image_height' => array( 'type' => 'textfield', 'heading' => 'Image Height', ), 'image_hover' => array( 'type' => 'select', 'heading' => 'Image Hover Effect', 'default' => '', 'options' => array( 'overlay-remove-50' => 'overlay-remove-50', 'overlay-add-50' => 'overlay-add-50', 'overlay-remove' => 'overlay-remove', 'overlay-add' => 'overlay-add', 'grayscale' => 'grayscale', 'color' => 'color', 'glow' => 'glow', 'fade-out' => 'fade-out', 'fade-in' => 'fade-in', 'blur' => 'blur', 'zoom-fade' => 'zoom-fade', 'zoom-long' => 'zoom-long', 'zoom' => 'zoom', ), ), ), )); } add_action('ux_builder_setup', 'wpvnuf_ux_builder_element_show_archive_post_list'); add_shortcode('wpvnuf_archive_post_list', 'wpvnuf_archive_post_list'); function wpvnuf_archive_post_list($atts, $content = null, $tag = '' ) { global $arr_current_ids; $ids = $arr_current_ids; //var_dump($ids); //echo json_encode ($ids); //return; extract(shortcode_atts(array( "_id" => 'row-'.rand(), 'style' => 'normal', 'class' => '', 'visibility' => '', // Layout "columns" => '3', "columns__md" => '2', "columns__sm" => '1', 'col_spacing' => 'normal', "type" => 'row', // slider, row, masonery, grid 'width' => '', 'grid' => '1', 'grid_height' => '600px', 'grid_height__md' => '500px', 'grid_height__sm' => '400px', 'slider_nav_style' => 'circle', 'slider_nav_position' => '', 'slider_nav_color' => 'light', 'slider_bullets' => 'false', 'slider_arrows' => 'true', 'auto_slide' => 'false', 'infinitive' => 'true', 'depth' => '', 'depth_hover' => '', // posts 'posts' => '', 'ids' => $ids, // Custom IDs 'cat' => '', 'category' => '', // Added for Flatsome v2 fallback 'excerpt' => 'visible', 'excerpt_length' => 15, 'offset' => '0', 'orderby' => 'date', 'order' => 'DESC', 'post_type' => '', 'style' => '', 'filter_by_term' => '', 'filter_by_term_value' => '', // Read more 'readmore' => '', 'readmore_color' => '', 'readmore_style' => 'outline', 'readmore_size' => 'small', // div meta 'post_icon' => 'false', 'comments' => 'false', 'show_date' => 'false', // badge, text 'badge_style' => '', 'show_category' => 'false', //Title 'title_size' => 'large', 'title_style' => '', // Box styles 'animate' => '', 'text_pos' => 'bottom', 'text_padding' => '', 'text_bg' => '', 'text_size' => '', 'text_color' => '', 'text_hover' => '', 'text_align' => 'center', 'image_size' => 'medium', 'image_width' => '', 'image_radius' => '', 'image_height' => '56%', 'image_hover' => '', 'image_hover_alt' => '', 'image_overlay' => '', 'image_depth' => '', 'image_depth_hover' => '', ), $atts)); // Stop if visibility is hidden if($visibility == 'hidden') return; ob_start(); $classes_box = array(); $classes_image = array(); $classes_text = array(); // Fix overlay color if($style == 'text-overlay'){ $image_hover = 'zoom'; } $style = str_replace('text-', '', $style); // Fix grids if($type == 'grid'){ if(!$text_pos) $text_pos = 'center'; $columns = 0; $current_grid = 0; $grid = flatsome_get_grid($grid); $grid_total = count($grid); flatsome_get_grid_height($grid_height, $_id); } // Fix overlay if($style == 'overlay' && !$image_overlay) $image_overlay = 'rgba(0,0,0,.25)'; // Set box style if($style) $classes_box[] = 'box-'.$style; if($style == 'overlay') $classes_box[] = 'dark'; if($style == 'shade') $classes_box[] = 'dark'; if($style == 'badge') $classes_box[] = 'hover-dark'; if($text_pos) $classes_box[] = 'box-text-'.$text_pos; if($image_hover) $classes_image[] = 'image-'.$image_hover; if($image_hover_alt) $classes_image[] = 'image-'.$image_hover_alt; if($image_height) $classes_image[] = 'image-cover'; // Text classes if($text_hover) $classes_text[] = 'show-on-hover hover-'.$text_hover; if($text_align) $classes_text[] = 'text-'.$text_align; if($text_size) $classes_text[] = 'is-'.$text_size; if($text_color == 'dark') $classes_text[] = 'dark'; $css_args_img = array( array( 'attribute' => 'border-radius', 'value' => $image_radius, 'unit' => '%' ), array( 'attribute' => 'width', 'value' => $image_width, 'unit' => '%' ), ); $css_image_height = array( array( 'attribute' => 'padding-top', 'value' => $image_height), ); $css_args = array( array( 'attribute' => 'background-color', 'value' => $text_bg ), array( 'attribute' => 'padding', 'value' => $text_padding ), ); // Add Animations if($animate) {$animate = 'data-animate="'.$animate.'"';} $classes_text = implode(' ', $classes_text); $classes_image = implode(' ', $classes_image); $classes_box = implode(' ', $classes_box); // Repeater styles $repeater['id'] = $_id; $repeater['tag'] = $tag; $repeater['type'] = $type; $repeater['class'] = $class; $repeater['visibility'] = $visibility; $repeater['style'] = $style; $repeater['slider_style'] = $slider_nav_style; $repeater['slider_nav_position'] = $slider_nav_position; $repeater['slider_nav_color'] = $slider_nav_color; $repeater['slider_bullets'] = $slider_bullets; $repeater['auto_slide'] = $auto_slide; $repeater['infinitive'] = $infinitive; $repeater['row_spacing'] = $col_spacing; $repeater['row_width'] = $width; $repeater['columns'] = $columns; $repeater['columns__md'] = $columns__md; $repeater['columns__sm'] = $columns__sm; $repeater['depth'] = $depth; $repeater['depth_hover'] = $depth_hover; $args = array( 'post_status' => 'publish', 'post_type' => $post_type, 'offset' => $offset, 'cat' => $cat, 'posts_per_page' => $posts, 'ignore_sticky_posts' => true, 'orderby' => $orderby, 'order' => $order, // 'tax_query' => array( // array( // 'taxonomy' => $filter_by_term, // 'field' => 'slug', // 'terms' => $filter_by_term_value, // ), // ), ); if (!$filter_by_term_value == "") { $args['tax_query'] = array( array( 'taxonomy' => $filter_by_term, 'field' => 'slug', 'terms' => $filter_by_term_value, ), ); } // echo "
";
// 	var_dump($args);
// 	echo "
"; // Added for Flatsome v2 fallback if ( get_theme_mod('flatsome_fallback', 0) && $category ) { $args['category_name'] = $category; } // If custom ids if ( !empty( $ids ) ) { $ids = explode( ',', $ids ); // var_dump($ids); $ids = array_map( 'trim', $ids ); $list_arr_post_type = array(); $args_search_all_post_type = array('public' => true,'capability_type' => 'post','show_ui' => true,'publicly_queryable' => true, 'exclude_from_search' => false ); $post_types_list_obj = get_post_types( $args_search_all_post_type,'objects' ); $arr_post_type_name = array(); foreach ( $post_types_list_obj as $post_type1 ) { array_push($arr_post_type_name,$post_type1->name); } //var_dump($arr_post_type_name); $args = array( 'post__in' => $ids, 'post_type' => $arr_post_type_name, 'numberposts' => -1, 'orderby' => 'post__in', 'offset' => $offset, 'posts_per_page' => $posts, 'ignore_sticky_posts' => true, ); // Include for search archive listing. if ( is_search() ) { $args['post_type'][] = 'page'; } } $recentPosts = new WP_Query( $args ); // Get repeater HTML. get_flatsome_repeater_start($repeater); while ( $recentPosts->have_posts() ) : $recentPosts->the_post(); $col_class = array( 'post-item' ); $show_excerpt = $excerpt; if(get_post_format() == 'video') $col_class[] = 'has-post-icon'; if($type == 'grid'){ if($grid_total > $current_grid) $current_grid++; $current = $current_grid-1; $col_class[] = 'grid-col'; if($grid[$current]['height']) $col_class[] = 'grid-col-'.$grid[$current]['height']; if($grid[$current]['span']) $col_class[] = 'large-'.$grid[$current]['span']; if($grid[$current]['md']) $col_class[] = 'medium-'.$grid[$current]['md']; // Set image size if($grid[$current]['size']) $image_size = $grid[$current]['size']; // Hide excerpt for small sizes if($grid[$current]['size'] == 'thumbnail') $show_excerpt = 'false'; } ?>
>
>
>
>
$taxonomy ){ $terms = get_the_terms( $recentPosts->ID, $taxonomy_slug ); if ( ! empty( $terms ) ) { foreach ( $terms as $term ) { echo ''.$term->name.' '; } } } // $categories = get_the_terms( $post->ID, 'event_type' ); // foreach( $categories as $category ) { // echo '

'.$category->name.'

'; // } //foreach((get_the_terms()) as $cat) { // echo $cat->cat_name . ' '; //} ?>