function offerPosts($instance) { extract($instance); $this->offer_posts_enqueue(); $offers = circleflip_query($this->build_query_args($instance)); switch ($type) { case '0': $layout = 'span4'; break; case '1': $layout = 'span3'; break; default: $layout = 'span4'; break; } ?> <div class="circleFlip row"> <!-- Single Offer to repeat --> <?php foreach ($offers as $offer) { $offer_meta = get_post_meta($offer->ID, 'cflip_offer_meta') ? get_post_meta($offer->ID, 'cflip_offer_meta', true) : ""; ?> <div class="<?php echo esc_attr($layout); ?> "> <div class="offerPost"> <?php echo get_the_post_thumbnail($offer->ID, 'team_member'); ?> <div class="offerPostContent"> <a href="<?php echo esc_url(get_the_permalink($offer->ID)); ?> "><h3 class="offers-title-text"><?php echo esc_html($offer->post_title); ?> </h3></a> <div> <?php if ($offer_meta['startDate'] & $offer_meta['endDate']) { ?> <div class="offerDate clearfix"> <span class="icon-calendar"></span> <p><?php echo date('d M', strtotime($offer_meta['startDate'])) . ' - '; echo date('d M', strtotime($offer_meta['endDate'])); ?> </p> </div> <?php } if ($offer_meta['person']) { ?> <div class="offerUsers clearfix"> <span class="icon-users"></span> <p><?php echo esc_html($offer_meta['person']); ?> </p> </div> <?php } ?> </div> <div class="clearfix offerPostLastRow"> <div class="offerPrice"><?php echo esc_html($offer_meta['price']); ?> </div> <div class="offerLink"> <a href="<?php echo esc_url(get_the_permalink($offer->ID)); ?> ">View Details</a> </div> </div> </div> </div> </div> <?php } ?> </div> <?php }
function circleflip_mag4_loadmore() { add_filter('circleflip_post_format_standard_html', 'circleflip_standard_mag4format', 10, 5); add_filter('circleflip_post_format_gallery_html', 'circleflip_standard_mag4format', 10, 5); add_filter('circleflip_post_format_video_html', 'circleflip_standard_mag4format', 10, 5); add_filter('circleflip_post_format_audio_html', 'circleflip_standard_mag4format', 10, 5); add_filter('circleflip_post_format_media_size', 'circleflip_standard_mag4format', 10, 5); add_filter('circleflip_post_format_meta', 'circleflip_standard_mag4format', 10, 5); /* * Latest Posts - Popular - Selected Posts * Blog Posts - Portfolio * with Latest or Popular (Selected Categories Multiple Select) * Order -> Ascending or descending * Number of Posts */ $post_or_portfolio = isset($_POST['post_or_portfolio']) && 'portfolio' == $_POST['post_or_portfolio'] ? 'circleflip-portfolio' : 'post'; $cat_key = 'post' == $post_or_portfolio ? 'cat' : 'tax_query'; if ('circleflip-portfolio' == $post_or_portfolio) { $tax_query = array(array('taxonomy' => 'circleflip-portfolio-cats', 'field' => 'id', 'terms' => isset($_POST['cat_id']) ? explode(',', $_POST['cat_id']) : array())); } else { $tax_query = isset($_POST['cat_id']) ? $_POST['cat_id'] : ''; } switch ($_POST['post_type']) { // Latest case '0': $args = array('posts_per_page' => $_POST['postsnumber'], $cat_key => $tax_query, 'post_type' => $post_or_portfolio, 'orderby' => 'date', 'order' => 'DESC', 'paged' => $_POST['pageNumber'], 'post_status' => 'publish'); break; // Popular // Popular case '1': global $wpdb; $args = array('posts_per_page' => $_POST['postsnumber'], 'post_type' => $post_or_portfolio, 'orderby' => 'post__in', 'post_status' => 'publish', $cat_key => $tax_query, 'post__in' => $wpdb->get_col("SELECT post_id, COUNT(*) as total FROM views_count WHERE 1 = 1 GROUP BY post_id ORDER BY total {$post_order}"), 'paged' => $_POST['pageNumber'], 'order' => 'DESC'); break; default: $args = array('posts_per_page' => $_POST['postsnumber'], $cat_key => $tax_query, 'post_type' => $post_or_portfolio, 'orderby' => 'date', 'order' => 'DESC', 'paged' => $_POST['pageNumber'], 'post_status' => 'publish'); break; } if (empty($_POST['cat_id'])) { unset($args[$cat_key]); } $output = circleflip_query($args); switch ($_POST['layout']) { case 'span4': $layout = 'span4'; $image_size = 'recent_home_posts_two'; break; case 'span3': $layout = 'span3'; $image_size = 'recent_home_posts'; break; case 'span6': $layout = 'span6'; $image_size = 'magazine_half'; break; default: $layout = 'span4'; $image_size = 'recent_home_posts_two'; break; } foreach ($output as $post) { $post->postData = ' <div class="' . $_POST['layout'] . ' magazinePost magazinePost4"> ' . circleflip_get_post_format_media($post->ID, $image_size, 'my_unique_mag4_posts') . ' </div>'; } echo json_encode($output); die; }
function block($instance) { extract($instance); $this->masonry_Posts(); add_filter('circleflip_post_format_gallery_html', 'circleflip_gallery_masonaryformat', 10, 5); add_filter('circleflip_post_format_standard_html', 'circleflip_standard_masonaryformat', 10, 5); add_filter('circleflip_post_format_video_html', 'circleflip_video_masonaryformat', 10, 5); add_filter('circleflip_post_format_audio_html', 'circleflip_audio_masonaryformat', 10, 5); add_filter('circleflip_post_format_media_size', 'circleflip_full_video_size', 10, 5); add_filter('circleflip_post_format_meta', 'circleflip_gallery_layout', 10, 5); /* * Latest Posts - Popular - Selected Posts * Blog Posts - Portfolio * with Latest or Popular (Selected Categories Multiple Select) * Order -> Ascending or descending * Number of Posts */ switch ($post_type) { // Latest case '0': $args = array('posts_per_page' => $post_number, 'cat' => isset($post_selected_cats) ? implode(',', $post_selected_cats) : '', 'post_type' => 'post', 'orderby' => 'date', 'order' => 'DESC', 'post_status' => 'publish'); break; // Popular // Popular case '1': global $wpdb; $args = array('posts_per_page' => $post_number, 'post_type' => 'post', 'orderby' => 'post__in', 'post_status' => 'publish', 'cat' => isset($post_selected_cats) ? implode(',', $post_selected_cats) : '', 'post__in' => $wpdb->get_col("SELECT post_id, COUNT(*) as total FROM views_count WHERE 1 = 1 GROUP BY post_id ORDER BY total {$post_order}"), 'order' => 'DESC'); break; // Selected Posts // Selected Posts case '2': if (circleflip_valid($post_selected_posts)) { $selectedPosts = implode(",", $post_selected_posts); } else { $selectedPosts = ''; } $args = array('include' => $selectedPosts, 'orderby' => 'date', 'order' => 'DESC'); break; default: break; } $output = circleflip_query($args); switch ($type) { case '0': $layout = 'span4'; break; case '1': $layout = 'span3'; break; default: $layout = 'span4'; break; } if ($output) { ?> <div class="masonary"> <div class="dotHeader"></div> <div class="titleBlock"><h3><?php echo esc_html($title); ?> </h3></div> </div> <div class="row masonryRow"> <div class="loading_portfolio"></div> <div class="masonryContainer clearfix"> <?php foreach ($output as $post) { setup_postdata($post); ?> <div class="masonryItem <?php echo esc_attr($layout); ?> "> <div class="masonryItemInner"> <?php echo circleflip_get_post_format_media($post->ID, 'masonry_post', 'my_unique_masonary_posts'); ?> </div> </div> <?php } echo '</div></div>'; } circleflip_end_query(); }
function magazineStyle4($instance) { extract($instance); $this->magazine_style4_enqueue(); /* * Latest Posts - Popular - Selected Posts * Blog Posts - Portfolio * with Latest or Popular (Selected Categories Multiple Select) * Order -> Ascending or descending * Number of Posts */ $post_selected_cats = isset(${"post_selected_cats_{$post_cat_type}"}) ? ${"post_selected_cats_{$post_cat_type}"} : array(); $output = circleflip_query($this->build_query_args($instance)); switch ($type_mag) { case '0': $layout = 'span4'; $image_size = 'recent_home_posts_two'; break; case '1': $layout = 'span3'; $image_size = 'recent_home_posts'; break; case '2': $layout = 'span6'; $image_size = 'magazine_half'; break; default: $layout = 'span4'; $image_size = 'recent_home_posts_two'; break; } $titleIconClass; switch ($titleIcon) { case 0: $titleIconClass = 'withoutIcon'; break; case 1: $titleIconClass = 'withIcon'; break; default: $titleIconClass = 'withoutIcon'; } $titleIconHead = ''; if ($titleIconClass == 'withIcon') { $iconHead; if (defined("ICL_LANGUAGE_CODE") && "ar" === ICL_LANGUAGE_CODE) { $iconHead = "icon-left-open-mini"; } else { $iconHead = "icon-right-open-mini"; } $titleIconHead = '<div class="headerDot"><span class="' . esc_attr($iconHead) . '"></span></div>'; } if ($output) { ?> <div class="magazineStyle magazineStyle4"> <?php if (circleflip_valid($title) || $post_type != 2 && $reload_section == "enable") { ?> <div class="titleBlock"> <?php if (circleflip_valid($title)) { ?> <h3 class="alignLeft"> <?php echo $titleIconHead . esc_html($title); ?> </h3> <?php } ?> <?php if ($post_type != 2 && $reload_section == "enable") { ?> <?php if (!circleflip_valid($title)) { ?> <h3 class="alignLeft"></h3> <?php } ?> <a class="loadMagazinePosts loadMagazine4Posts" data-pagenumber="2" data-posttype="<?php echo esc_attr($post_type); ?> " data-layout="<?php echo esc_attr($layout); ?> " data-postsnumber="<?php echo esc_attr($post_number); ?> " data-cats="<?php echo isset($post_selected_cats) ? esc_attr(implode(',', $post_selected_cats)) : ''; ?> " data-post-or-portfolio="<?php echo esc_attr($post_cat_type); ?> "> <span class="icon-spin3"></span> </a> <?php } ?> </div> <?php } ?> <div class="circleFlip row"> <?php global $post; foreach ($output as $post) { setup_postdata($post); ?> <div class="<?php echo esc_attr($layout . ' ' . $entrance_animation); ?> magazinePost magazinePost4 animateCr"> <!-- Magazine post Image --> <div class="image"> <?php if (has_post_thumbnail($post->ID)) { ?> <?php echo get_the_post_thumbnail($post->ID, $image_size); ?> <?php } else { echo circleflip_get_default_image($image_size); ?> <?php } ?> </div> <!-- Magazine post Right part --> <div class="magazineData"> <!-- Magazine post Author --> <div class="magazinePostAuthor"> <?php echo get_avatar($post->post_author); ?> <a href="<?php echo esc_url(get_author_posts_url($post->post_author)); ?> "><p><?php the_author_meta('display_name'); ?> </p></a> </div> <!-- Magazine post Date --> <div class="magazinePostDate"> <p> /</p> <span><?php echo get_the_date('d M Y'); ?> </span> </div> <!-- Magazine post title --> <?php $original_title = $post->post_title; $mag_post_title = circleflip_string_limit_characters($original_title, '45'); ?> <a class="magazinePostTitle" href="<?php the_permalink(); ?> "><h4><?php echo esc_html($mag_post_title); ?> </h4></a> <!-- Magazine post Categories --> <div class="magazineCategories"> <?php $post_categories = wp_get_post_categories(get_the_ID()); $cats = array(); for ($i = 0; $i < count($post_categories); $i++) { $cat = get_category($post_categories[$i]); $cat_name = $cat->name; $cat_link = get_category_link($cat->cat_ID); //$cats[] = array( 'name' => $cat->name, 'slug' => $cat->slug ); if ($i != count($post_categories) - 1) { echo ' <a href=' . esc_url($cat_link) . '><p>' . esc_html($cat_name) . ' , </p></a>'; } else { echo ' <a href=' . esc_url($cat_link) . '><p>' . esc_html($cat_name) . '</p></a>'; } } ?> </div> <!-- Magazine post excerpt --> <?php $original_text = sanitize_text_field($post->post_content); $mag_post_text = circleflip_string_limit_characters($original_text, '125'); ?> <p class="magazinePostExcerpt"><?php echo $mag_post_text; ?> </p> <!-- Magazine post views & comments number --> <div class="magazinePostViews"> <span class="icon-eye"></span> <span class="mag_views_no"> <?php if (cr_get_option("rtl", '0') == '1') { $standard = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); $east_arabic = array("٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"); $numOfViews = circleflip_read_number_of_views(get_the_ID()); $numOfViews = str_replace($standard, $east_arabic, $numOfViews); } else { $numOfViews = circleflip_read_number_of_views(get_the_ID()); } echo esc_html($numOfViews); ?> </span> </div> <div class="magazinePostComments"> <span class="icon-comment-1"></span> <span class="mag_comments_no"> <?php comments_number('0'); ?> </span> </div> <div class="magazinePostBtn"> <!-- <a href="<?php the_permalink(); ?> "><?php _e('more..', 'circleflip'); ?> </a> --> <a href="<?php the_permalink(); ?> " class=""> <span><?php _e('Read More..', 'circleflip'); ?> </span> </a> </div> </div> </div> <?php } ?> </div> </div> <?php if ($check_element_color == 1) { ?> <style> <?php $id_modified = str_replace('_', '-', $block_id); ?> #<?php echo $id_modified; ?> .magazinePost4 .image .magazinePostDate, #<?php echo $id_modified; ?> .magazinePostViews .mag_views_no, #<?php echo $id_modified; ?> .magazinePostComments .mag_comments_no, #<?php echo $id_modified; ?> [class*="btnStyle"].red{ background-color: <?php echo $elements_color; ?> ; } #<?php echo $id_modified; ?> .magazinePostTitle h4:hover, #<?php echo $id_modified; ?> .color, #<?php echo $id_modified; ?> .magazinePost4 .magazinePostBtn a:hover, #<?php echo $id_modified; ?> .magazinePost4 .magazinePostAuthor p:hover, #<?php echo $id_modified; ?> .magazinePost4 .magazineCategories p{ color: <?php echo $elements_color; ?> !important; } #<?php echo $id_modified; ?> .magazinePostViews .mag_views_no, #<?php echo $id_modified; ?> .magazinePostComments .mag_comments_no, #<?php echo $id_modified; ?> .magazinePost4 .magazinePostBtn a:hover{ border-color: <?php echo $elements_color; ?> ; } </style> <?php } } circleflip_end_query(); }