have_posts()) { $output .= '
'; while ($the_query->have_posts()) { $the_query->the_post(); $output .= '
'; $output .= '
  • ' . get_the_title() . '
    ' . strip_tags(mb_substr(get_the_content(), 0, (int) $atts['preview_text_chars'])) . '...
    » Read more
'; $output .= '
'; if ($atts['show_featured_image']) { if (has_post_thumbnail(get_the_ID())) { $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'single-post-thumbnail'); $output .= '' . get_the_title()
                            . ''; } } $output .= '
'; $output .= '
'; } $output .= '
'; if ($atts['append_css_clear']) { $output .= '
'; } } wp_reset_postdata(); return $output; } /** * Shortcode handler for plugin. Takes care of setting default options. * @param array $atts * @param string? $content * @return string */ function kerstnerat_simple_random_posts_shortcode($atts, $content = null) { $originalAtts = $atts; $attsCombined = shortcode_atts(array( 'title' => '', 'author' => '', 'append_css_clear' => true, 'category' => '', 'container_css_class' => 'articles-preview-container', 'container_article_css_class' => 'article-preview', 'container_left_width' => '65%', 'container_right_width' => '30%', 'date_format' => '(n/j/Y)', 'display_posts_off' => false, 'exclude_current' => false, 'featured_image_height' => 100, 'header' => false, 'id' => false, 'ignore_sticky_posts' => true, 'image_size' => false, 'include_title' => true, 'include_author' => false, 'include_content' => true, 'include_date' => false, 'include_excerpt' => false, 'meta_key' => '', 'meta_value' => '', 'no_posts_message' => '', 'offset' => 0, 'order' => 'DESC', 'orderby' => 'rand', 'post_parent' => false, 'post_status' => 'publish', 'post_type' => 'post', 'posts_per_page' => 5, 'show_featured_image' => true, 'preview_text_chars' => 200, 'tag' => '', 'tax_operator' => 'IN', 'tax_term' => false, 'taxonomy' => false, 'wrapper' => 'ul', 'wrapper_class' => 'display-posts-listing', 'wrapper_id' => false, ), $atts, 'display-posts'); $output = ''; if (isset($attsCombined['header'])) { $output .= $attsCombined['header']; } return ($output . kerstnerat_simple_random_posts($attsCombined)); }