I've created a customize page show all posts with template:
<?php
/*
Template Name: All posts
*/
get_header();
?>
</header>
<div role="main" id="content" class="content-warp">
<div class="container">
<div id="primary" class="content-area col-md-8 post-list">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post">
<div class="entry">
<?php the_content(); ?>
<?php
$current_date = "";
$count_posts = wp_count_posts();
$nextpost = 0;
$published_posts = $count_posts->publish;
$myposts = get_posts(array('posts_per_page' => $published_posts));
foreach ($myposts as $post) :
get_template_part('content', 'content-single');
?>
<?php endforeach; ?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php get_sidebar('page'); ?>
<div style="clear:both"></div>
</div>
</div>
<?php get_footer(); ?>
But it not show post_content of Posts (all remain data are normal).
By the way, with default UI Categories (content.php), i just call below code and everything Ok: the same UI with new template but have post_content).
<?php get_template_part( 'content', 'single' ); ?>
I don't know why post_content is null in new my template. I'm using Llorix One LiteVersion: 0.1.7
Any help, thanks.
I try read document again and realize the_content not set data yet. So, just add setup post data, look like:
...
foreach($myposts as $post) : setup_postdata( $post );
...
Also You can use new WP Query
$myposts = new WP_QUery(array(
'posts_per_page' => $published_posts
));
if ($myposts->have_posts()): ?>
<?php while ($myposts->have_posts()) {
$myposts->the_post();
get_template_part('content', 'content-single');
} ?>
<?php endif ?>
<?php wp_reset_query(); ?>