I have checked archive pages with standard themes Twenty Sixteen and Twenty Seventeen.
Posts have tag “more”. All excerpts are shown correctly.
Thanks for a quick reply;
Yes, apologies for posting before doing more research. I’ve done more digging and it seems this problem occurs if we use a custom wp_query (this example is enough to break it):
$query = new WP_Query( array( 'post_type' => 'post') );
while ($query->have_posts()){
$query->the_post();
the_content();
}
[Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]
-
This reply was modified 9 years ago by
bdbrown.
If you are using theme from Theme Directory
https://ww.wp.xz.cn/themes/
then give me link to it.
Tested in default Twentysixteen theme.
Created a page template testmoretag.php with the following code in it, and assigned a page to it (the problem is still there):
<?php /* Template Name: Test MoreTag */ ?>
<?php get_sidebar(); ?> <!-- only WPGlobus language switcher in the sidebar -->
<?php
$query = new WP_Query( array( ‘post_type’ => ‘post’) );
while ($query->have_posts()){
$query->the_post();
echo '<br> -----';
the_content();
echo '<br>';
}
?>
[Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]
-
This reply was modified 9 years ago by
bdbrown.
Try this
<?php
/* Template Name: Test MoreTag */ ?>
<?php get_sidebar(); ?> <!– only WPGlobus language switcher in the sidebar –>
<?php
$query = new WP_Query( array( ‘post_type’ => ‘post’) );
while ($query->have_posts()) {
$query->the_post();
$query->post->post_content = apply_filters('the_content', $query->post->post_content);
foreach ( $query->posts as $key=>$post ) {
$query->posts[$key]->post_content = apply_filters('the_content', $post->post_content);
}
echo ‘<br> —–‘;
the_content();
echo ‘<br>’;
}
?>
Thank you. Your suggestion worked for me 🙂
$iteration = 0;
while ($query->have_posts()) {
$query->posts[$iteration]->post_content = apply_filters(‘the_content’, $query->posts[$iteration]->post_content);
$query->the_post();
echo ‘<br> —–‘;
the_content();
echo ‘<br>’;
$iteration++;
}
-
This reply was modified 9 years ago by
gedaswork.