<?php } else { ?> <div class="hover-icon"><?php _e('View Post', 'chow'); ?> </div> <?php } ?> </a> </div> <!-- Content --> <div class="recipe-box-content <?php $ratings = check_post_rating(); if ($ratings > 0) { echo 'has-stars'; } else { echo 'no-stars'; } ?> "> <h3><a href="<?php echo esc_url(get_permalink()); ?> "><?php the_title(); ?> </a></h3>
function chow_posts_grid($atts, $content) { extract(shortcode_atts(array('limit' => '4', 'orderby' => 'date', 'order' => 'DESC', 'categories' => '', 'tags' => '', 'width' => 'sixteen', 'place' => 'center', 'exclude_posts' => '', 'ignore_sticky_posts' => 1), $atts)); $output = ''; $randID = rand(1, 99); // Get unique ID for carousel if (empty($width)) { $width = "sixteen"; } //set width to 16 even if empty value wp_reset_query(); $args = array('post_type' => 'post', 'posts_per_page' => $limit, 'orderby' => $orderby, 'order' => $order); if (!empty($exclude_posts)) { $exl = explode(",", $exclude_posts); $args['post__not_in'] = $exl; } if (!empty($categories)) { //$categories = explode(",", $categories); $args['category_name'] = $categories; } if (!empty($tags)) { $tags = explode(",", $tags); $args['tag__in'] = $tags; } $i = 0; $wp_query = new WP_Query($args); $mainclass = "four columns"; $imagesize = 'blog-size'; if ($wp_query->have_posts()) { $output .= '<div class="isotope">'; while ($wp_query->have_posts()) { $wp_query->the_post(); $i++; $id = $wp_query->post->ID; $is_recipe = false; $ingredients = get_post_meta($wp_query->post->ID, 'cookingpressingridients', true); if (!empty($ingredients)) { $is_recipe = true; } $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url($thumb); $author_id = $wp_query->post->post_author; $output .= ' <div class="' . $mainclass . ' recipe-box columns"> <!-- Thumbnail --> <div class="thumbnail-holder"> <a href="' . esc_url(get_permalink()) . '"> ' . get_the_post_thumbnail($id, $imagesize) . ' <div class="hover-cover"></div>'; $ingredients = get_post_meta($wp_query->post->ID, 'cookingpressingridients', true); if (!empty($ingredients)) { $output .= ' <div class="hover-icon">' . __('View Recipe', 'chow') . '</div>'; } else { $output .= '<div class="hover-icon">' . __('View Post', 'chow') . '</div>'; } $output .= '</a> </div>'; $ratings = check_post_rating(); if ($ratings > 0) { $output .= '<div class="recipe-box-content has-stars">'; } else { $output .= '<div class="recipe-box-content no-stars">'; } $output .= '<h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>'; ob_start(); do_action('foodiepress-rating'); if ($is_recipe) { do_action('grid-post-meta'); } else { do_action('no-recipe-post-meta'); } $below_shortcode = ob_get_contents(); ob_end_clean(); $output .= $below_shortcode; $output .= ' <div class="clearfix"></div> </div> </div>'; } // close the Loop $output .= '</div>'; } return $output; }