'', 'banner_link' => '', 'title' => '', 'text' => '', 'btn_text' => '', 'target' => '', 'custom_class' => '' ), $atts)); // Get the URL to the content area. $content_url = untrailingslashit( content_url() ); // Find latest '/' in content URL. $last_slash_pos = strrpos( $content_url, '/' ); // 'wp-content' or something else. $content_dir_name = substr( $content_url, $last_slash_pos - strlen( $content_url ) + 1 ); $pos = strpos( $img, $content_dir_name ); if ( false !== $pos ) { $img_new = substr( $img, $pos + strlen( $content_dir_name ), strlen( $img ) - $pos ); $img = $content_url . $img_new; } $output = '
'; $output = apply_filters( 'cherry_plugin_shortcode_output', $output, $atts, $shortcodename ); return $output; } add_shortcode('banner', 'banner_shortcode'); } /** * Post Grid * */ if (!function_exists('posts_grid_shortcode')) { function posts_grid_shortcode( $atts, $content = null, $shortcodename = '' ) { extract(shortcode_atts(array( 'type' => 'post', 'category' => '', 'custom_category' => '', 'tag' => '', 'columns' => '3', 'rows' => '3', 'order_by' => 'date', 'order' => 'DESC', 'thumb_width' => '370', 'thumb_height' => '250', 'meta' => '', 'excerpt_count' => '15', 'link' => 'yes', 'link_text' => __('Read more', CURRENT_THEME), 'custom_class' => '' ), $atts)); $spans = $columns; $rand = rand(); // columns switch ($spans) { case '1': $spans = 'span12'; break; case '2': $spans = 'span6'; break; case '3': $spans = 'span4'; break; case '4': $spans = 'span3'; break; case '6': $spans = 'span2'; break; } // check what order by method user selected switch ($order_by) { case 'date': $order_by = 'post_date'; break; case 'title': $order_by = 'title'; break; case 'popular': $order_by = 'comment_count'; break; case 'random': $order_by = 'rand'; break; } // check what order method user selected (DESC or ASC) switch ($order) { case 'DESC': $order = 'DESC'; break; case 'ASC': $order = 'ASC'; break; } // show link after posts? switch ($link) { case 'yes': $link = true; break; case 'no': $link = false; break; } global $post; global $my_string_limit_words; $numb = $columns * $rows; // WPML filter $suppress_filters = get_option('suppress_filters'); $args = array( 'post_type' => $type, 'category_name' => $category, $type . '_category' => $custom_category, 'tag' => $tag, 'numberposts' => $numb, 'orderby' => $order_by, 'order' => $order, 'suppress_filters' => $suppress_filters ); $posts = get_posts( $args ); if ( empty( $posts ) ) { wp_reset_postdata(); return; } $i = 0; $count = 1; $output_end = ''; $countul = 0; if ($numb > count($posts)) { $output_end = ''; } $output = ''; $output .= wp_trim_words($excerpt,$excerpt_count); $output .= '
'; } if($link){ $output .= ''; $output .= $link_text; $output .= ''; } $output .= '