function magazineStyle2($instance) { extract($instance); $this->magazine_style2_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 = 'thumbnail'; break; case '1': $layout = 'span3'; $image_size = 'thumbnail'; break; case '2': $layout = 'span6'; $image_size = 'thumbnail'; default: $layout = 'span6'; $image_size = 'thumbnail'; 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 magazineStyle2"> <?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 loadMagazine2Posts" 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 magazinePost2 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 class="magazinePostDate"> <span class="magazineDay"><?php echo get_the_date('d'); ?> </span> <span class="magazineMonth"><?php echo get_the_date('M'); ?> </span> </div> </div> <!-- Magazine post Right part --> <div class="magazineData"> <!-- Magazine post title --> <?php $original_title = $post->post_title; $mag_post_title = circleflip_string_limit_words($original_title, '2'); ?> <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 < 2; $i++) { //less than 2 to get only 2 categories $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 && $i != 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>'; echo '<p>/</p>'; } } ?> <!-- Magazine post Author --> <a class="magazinePostAuthor" href="<?php echo get_author_posts_url($post->post_author); ?> "><p class="color"><?php the_author_meta('display_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, 90); ?> <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="btnStyle1 red btnSmall btnCenter"> <span><?php _e('more..', 'circleflip'); ?> </span> <span class="btnBefore"></span> <span class="btnAfter"></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; ?> .magazinePost2 .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; ?> .magazineCategories a p:hover, #<?php echo $id_modified; ?> .color { 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; ?> [class*="btnStyle"].red .btnAfter, #<?php echo $id_modified; ?> [class*="btnStyle"].red .btnBefore{ border-color: <?php echo $elements_color; ?> ; } </style> <?php } } circleflip_end_query(); }
function circleflip_standard_mag2format($media_html, $post_id, $size, $ident, $audiovideo) { $post = get_post($post_id); if ('my_unique_mag2_posts' == $ident) { $src = ''; $image_mag = ''; if (has_post_thumbnail($post_id)) { $image_id = get_post_thumbnail_id($post_id); $image_mag = wp_get_attachment_image_src($image_id, $size); $src = $image_mag[0]; } ob_start(); ?> <!-- Magazine post Image --> <div class="image"> <?php if (circleflip_valid($src)) { ?> <?php echo wp_get_attachment_image($image_id, $size); ?> <?php } else { echo circleflip_get_default_image($size); ?> <?php } ?> <div class="magazinePostDate"> <span class="magazineDay"><?php echo get_the_time('d', $post->ID); ?> </span> <span class="magazineMonth"><?php echo get_the_time('M', $post->ID); ?> </span> </div> </div> <!-- Magazine post Right part --> <div class="magazineData"> <!-- Magazine post title --> <?php $original_title = $post->post_title; $mag_post_title = circleflip_string_limit_words($original_title, '2'); ?> <a class="magazinePostTitle" href="<?php echo get_permalink($post->ID); ?> "><h4><?php echo esc_html($mag_post_title); ?> </h4></a> <!-- Magazine post Categories --> <div class="magazineCategories"> <?php $post_categories = wp_get_post_categories($post->ID); $cats = array(); for ($i = 0; $i < count($post_categories) && $i < 2; $i++) { //less than 2 to get only 2 categories $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 && $i != 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>'; echo '<p>/</p>'; } } ?> <!-- Magazine post Author --> <a class="magazinePostAuthor" href="<?php echo get_author_posts_url($post->ID); ?> "><p class="color"><?php the_author_meta('display_name', $post->post_author); ?> </p></a> </div> <!-- Magazine post excerpt --> <?php $original_text = sanitize_text_field($post->post_content); $mag_post_text = circleflip_string_limit_characters($original_text, '90'); ?> <p class="magazinePostExcerpt"><?php echo esc_html($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($post->ID); $numOfViews = str_replace($standard, $east_arabic, $numOfViews); } else { $numOfViews = circleflip_read_number_of_views($post->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 echo get_permalink($post->ID); ?> " class="btnStyle1 red btnSmall btnCenter"> <span><?php _e('more..', 'circleflip'); ?> </span> <span class="btnBefore"></span> <span class="btnAfter"></span> </a> </div> </div> <?php $media_html = ob_get_clean(); } return $media_html; }