function quasar_get_featured_image($echo = true, $featured_image_size = 'rockthemes_featured', $hover_active = true) { global $post, $rockthemes_advanced_details; $display_video_directly = true; if (!$rockthemes_advanced_details) { $rockthemes_advanced_details = get_post_meta($post->ID, 'advanced_post_details', true); } $post_format = get_post_format(); if ($post_format === 'gallery') { return; } $return = '<div class="relative-container rockthemes-hover">'; $media = ''; //First check if there is a video for this post if (isset($rockthemes_advanced_details['video_iframe_code']) && !empty($rockthemes_advanced_details['video_iframe_code'])) { //Post contains a video in the Advanced Details field if ($display_video_directly) { $media .= quasar_embed_video($rockthemes_advanced_details['video_iframe_code']); } } elseif (isset($rockthemes_advanced_details['extra_featured_images']) && is_array($rockthemes_advanced_details['extra_featured_images']) && count($rockthemes_advanced_details['extra_featured_images']) && $rockthemes_advanced_details['extra_featured_images'][0] != '') { //There are extra images bound to this post. We will return as Swiper Slider $media .= rockthemes_make_swiperslider_shortcode($post->ID, $featured_image_size); } elseif (wp_get_attachment_image(get_post_thumbnail_id($post->ID), $featured_image_size)) { $media .= wp_get_attachment_image(get_post_thumbnail_id($post->ID), $featured_image_size); if ($hover_active) { $media .= quasar_hover_effect($post->ID, true, isset($post) && is_single() ? false : true); } } if ($media) { $return .= $media; } else { return ''; } //If there is no value entered for the $return we will turn back as empty string. $return .= '</div>'; //Close relative-container div if ($echo) { echo $return; } else { return $return; } }
function rockthemes_gallery_load_more($atts) { if (!isset($atts)) { return; } global $paged; extract($atts); //Hover Details for the image $hover_obj = array('activate_hover_box' => sanitize_text_field($activate_hover_box), 'activate_hover' => sanitize_text_field($activate_hover), 'disable_hover_link' => sanitize_text_field($disable_hover_link), 'small_thumb_hover' => sanitize_text_field($small_thumb_hover)); //Columns Class $block_class = ' large-block-grid-' . esc_attr($block_grid_large) . ' medium-block-grid-' . esc_attr($block_grid_medium) . ' small-block-grid-' . esc_attr($block_grid_small) . ' '; if ($masonry === 'true') { $block_class .= ' rockthemes-masonry '; } //Only one hover effect can be used if ($activate_hover_box === 'true') { $activate_hover = 'false'; } //$id = "quasar-portfolio-".$GLOBALS['rockthemes_gallery']; $post_is_tax = false; $tax_list = get_object_taxonomies(sanitize_text_field($post_type)); //get_object_taxonomies $post_tax; foreach ($tax_list as $tax) { if (strpos($tax, 'cat') > -1) { $post_tax = $tax; break; } } if (get_query_var('paged')) { //Works for the pages called from index.php $paged = get_query_var('paged'); } elseif (get_query_var('page')) { //Works for the shortcodes $paged = get_query_var('page'); } else { $paged = 1; } //$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $posts = array(); if ($post_type === 'post') { $posts = query_posts(array('category_name' => esc_attr($category), 'posts_per_page' => (int) $total, 'offset' => (int) $offset, 'paged' => $paged)); } if (!count($posts)) { $args = array('post_type' => sanitize_text_field($post_type), esc_attr($post_tax) => esc_attr($category), 'posts_per_page' => (int) $total, 'offset' => (int) $offset, 'paged' => $paged); $posts = query_posts($args); $post_is_tax = true; } $return = ''; //if($boxed_layout == "true") $return .= '<div class="boxed-layout boxed-colors quasar-portfolio padding-2x">'; $return .= '<div id="' . $id . '" class="quasar-portfolio-container grid ' . ($use_shadow === 'true' ? 'use-shadow' : '') . ' ' . ($boxed_layout === 'true' ? 'boxed_layout_holder' : '') . '">'; if ($header_title != '') { //Header for hybrid layout - Grid and List $return .= '<div class="quasar-portfolio-header">'; if ($header_title != '') { $return .= '<div class="quasar-portfolio-main-title">' . sanitize_text_field($header_title) . '</div>'; } $return .= '<div class="clear"></div> </div> <br/> '; } //Body $return .= '<ul class="quasar-portfolio-body ' . $block_class . '" class-ref="' . $block_class . '">'; if (isset($is_ajax) && $is_ajax === 'true') { $return = ''; } if (sizeof($posts) > 0) { $count_columns = 1; foreach ($posts as $post_object) { global $post, $rockthemes_advanced_details; $post = $post_object; setup_postdata($post); $rockthemes_advanced_details = get_post_meta($post->ID, 'advanced_post_details', true); $cat_list = wp_get_post_terms($post->ID, $post_tax); $link_html = ''; $total_cat = count($cat_list); $c = 0; foreach ($cat_list as $cat) { $tax = get_category_by_slug($cat->slug); if (!$tax) { $tax = get_term_link($cat->slug, $post_tax); } else { $tax = get_category_link($post_tax); } $link_html .= '<a href="' . $tax . '">' . $cat->name . '</a>'; $c++; if ($c < $total_cat) { $link_html .= ', '; } } $featuredBig = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'ajax-filtered-hover'); if ($featuredBig) { $featuredBig = $featuredBig[0]; } else { $featuredBig = wp_get_attachment_url(get_post_thumbnail_id($post->ID)) && !$featuredBig ? wp_get_attachment_url(get_post_thumbnail_id($post->ID)) : 'no-image'; } $thumbnail = wp_get_attachment_image(get_post_thumbnail_id($post->ID), $image_size); $title = $thumbnail ? $thumbnail : $post->post_title; if ($use_swiper_for_thumbnails === 'true') { $title = rockthemes_make_swiperslider_shortcode($post->ID, $image_size); } $link = get_post_permalink($post->ID); $excerpt = rock_check_p($post->post_excerpt); $product_price = ''; if (get_post_meta($post->ID, '_sale_price', true) != '' && rockthemes_woocommerce_active()) { $product_price = woocommerce_price(get_post_meta($post->ID, '_sale_price', true)); $excerpt = '<div class="remove-foundation-padding"><div class="large-9 columns">' . rock_check_p($post->post_excerpt) . '</div><div class="price-holder large-3 columns right-text">' . $product_price . '</div></div>'; } if ($link != '' && $activate_hover != 'true') { $title = '<div class="relative-container rockthemes-hover"><a href="' . esc_url($link) . '">' . $title . '</a></div>'; } if ($activate_hover == 'true') { $hover_effect = quasar_hover_effect($post->ID, $use_shadow === 'true' ? true : false, $disable_hover_link !== 'false' ? false : true); $title = '<div class="relative-container rockthemes-hover">' . $title . $hover_effect . '</div>'; } $description = ''; $list_description = ''; $desc_details = explode('_', $excerpt_title_option); $desc_details_price_active = false; if (strpos($excerpt_title_option, 'price') > -1) { $desc_details_price_active = true; } $desc_details_excerpt_active = false; if (strpos($excerpt_title_option, 'price') > -1) { $desc_details_excerpt_active = true; } if ($excerpt_title_option != "no_description") { foreach ($desc_details as $detail) { switch ($detail) { case 'title': if ($activate_header_link === 'false') { $description .= '<p class="quasar-portfolio-title">' . get_the_title() . '</p>'; } else { $description .= '<p class="quasar-portfolio-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></p>'; } if ($activate_category_link === 'true') { //Check if user activates the category link $description .= '<p class="quasar-portfolio-category-link">' . $link_html . '</p>'; } break; case 'excerpt': /* ** WooCommerce ** if($desc_details_price_active) $description .= '<div class="row"><div class="large-9 columns">'; */ if ($desc_details_price_active) { $description .= '<div>'; } $description .= '<p class="quasar-portfolio-excerpt">' . rockthemes_excerpt($post->post_excerpt, $excerpt_length) . '</p>'; if ($desc_details_price_active) { $description .= '</div>'; } /* Read More for products. Currently stopped for using buttons. Works without a problem if($desc_details_price_active) $list_description .= '<div class="row"><div class="large-9 columns">'; $list_description .= '<p class="quasar-portfolio-excerpt">'.rock_check_p(($post->post_excerpt).quasar_read_more()).'</p>'; if($desc_details_price_active) $list_description .= '</div>'; */ break; case 'price': /* TO DO : WooCommerce Price Field. Works but needs visual improvments. if($desc_details_excerpt_active) $description .= '<div class="large-3 columns">'; $description .= '<p class="quasar-price">'.$product_price.'</p>'; if($desc_details_excerpt_active) $description .= '</div></div>'; if($desc_details_excerpt_active) $list_description .= '<div class="large-3 columns">'; $list_description .= '<p class="quasar-price">'.$product_price.'</p>'; if($desc_details_excerpt_active) $list_description .= '</div></div>'; */ break; } } } $boxed_cover_html_pre = ''; $boxed_cover_html_after = ''; $boxed_cover_html_class = ''; $boxed_cover_list_before = ''; $boxed_cover_list_after = ''; if ($boxed_layout == "true") { $boxed_cover_html_pre = '<div class="boxed_layout_holder boxed-layout boxed-colors columns" ref="boxed-layout boxed-colors">'; $boxed_cover_html_after = '</div>'; $boxed_cover_html_class = 'boxed-layout boxed-colors quasar-portfolio'; } $return .= $boxed_cover_list_before . '<li featured-big="' . $featuredBig . '">' . $title . $boxed_cover_html_pre . '<div class="grid-description">' . $description . '</div><div class="list-description ' . ($boxed_layout === 'true' ? 'large-7 medium-7 columns' : '') . '" class-ref="7">' . $list_description . '</div>' . $boxed_cover_html_after . '</li>' . $boxed_cover_list_after; } } else { $return .= '<div class="large-12 columns">' . __("No data found!", "quasar") . '</div>'; } if (!isset($is_ajax) || isset($is_ajax) && $is_ajax === 'false') { $return .= '</ul>'; //End of Body $return .= '<div class="clear"></div>'; if ($pagination === 'true') { //Footer navigation $return .= quasar_paging_nav(); } wp_reset_query(); wp_reset_postdata(); $args['posts_per_page'] = -1; $args['paged'] = 0; $args['nopaging'] = true; $total_query = new WP_Query($args); $return .= '<div class="total-posts-number-holder hide" data-query-total="' . $total_query->found_posts . '"></div>'; $return .= '</div>'; //End of HTML field } //var_dump(wp_count_posts()); return $return; }