<?php /*******************************/ /**** Single Post Template ****/ /*******************************/ // This template is used for blog posts, and any other post type that doesn't have a single-{post-type}.php file while (have_posts()) { the_post(); ?> <?php ac_load_post_content(); ?> <?php }
function ac_posts_list($args, $posts = null) { global $ac_show_title, $ac_show_excerpt, $ac_show_read_more; // Define the defaults $defaults = array('post_type' => 'post', 'posts_per_page' => 10, 'cat' => '', 'ac_order' => 'order_date_desc', 'show_title' => true, 'show_excerpt' => true, 'show_read_more' => true); // Merge in the options $args = wp_parse_args($args, $defaults); // Params to variables extract($args); // Generate our posts if not passed in if ($posts == null) { ac_prepare_args_for_get_posts($args); // Get our posts $posts = get_posts($args); } // Clean up the bool values. Might be "true" $ac_show_title = filter_var($show_title, FILTER_VALIDATE_BOOLEAN); $ac_show_excerpt = filter_var($show_excerpt, FILTER_VALIDATE_BOOLEAN); $ac_show_read_more = filter_var($show_read_more, FILTER_VALIDATE_BOOLEAN); // Render the output ob_start(); ?> <div class='list-posts'> <?php global $post; foreach ($posts as $post) { // Setup the new post setup_postdata($post); ac_load_post_content(); } wp_reset_postdata(); ?> </div> <?php $output = ob_get_contents(); ob_end_clean(); return $output; }