I’ve found the solution. According to https://codex.wordpress.org/Function_Reference/the_content#Overriding_Archive.2FSingle_Page_Behavior, one must add
global $more;
$more = 0;
before the call to the_content()
. So now my inner loop reads:
<?php
$recent_posts_query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => 5));
while ($recent_posts_query->have_posts())
{
$recent_posts_query->the_post();
?>
<div class="post">
<h3><?php echo the_title(); ?></h3>
<p>by <?php the_author(); ?></p>
<?php
global $more;
$more = 0;
the_content();
?>
</div>
<?php
}
?>
Related Posts:
- When to use is_home() vs is_front_page()?
- Change loop order via form or link (jquery, not URL)
- Set front page as static page [closed]
- the_content() in single-{post-type}.php problem
- How to retrieve an image from a post and display it before excerpt of a post? [duplicate]
- Custom Blocks as part of a theme
- Suppress the_content filter in a nested loop
- Not Found when using activity stream as front page with BuddyPress
- Are content.php and content-single.php the same?
- Get ‘page’ number with infinite scroll
- How does WordPress decide what template to use as frontpage
- How do I show sticky posts on a static front page that also contains content?
- Grab the first paragraph of each post
- How to create custom home page via plugin?
- Should we localize custom-made themes / plugins?
- How can I remove the Static Front Page option from the Customizer
- query posts in wordpress
- How can i customize the comment list
- How to handle theme customization and sass variables
- wp_enqueue_scripts not called on search page?
- WordPress how to override function adjacent_posts_rel_link_wp_head() in link-template.php the correct way
- Best approach to create sites with Modular Content? [closed]
- Finding Page Template and Displaying Content
- What’s the best action to use when you want to do something only once per theme setup?
- Customizer API and add_panel(). Panel doesn’t show
- How to correctly add JQuery in a WP theme?
- Why is the first query affecting the second query, even after wp_reset_query() and wp_reset_postdata(), but not on the second page?
- Creating multiple hooks for theme
- Some doubts about how to show posts in a custom theme?
- What is the best way to handle multiple calls to get_template_directory_uri() and similar functions?
- Static Front-Page Excerpts
- How to add a second stylesheet to the editor
- How to reorganize the items returned by wp_list_comments()?
- paged > max_num_pages won’t throw 404
- Conditional statement to show pagination
- How to create a custom template to admin dashboard
- Limit Loop to 5 Posts?
- How do I Add images uploaded in the post to a default custom field
- How to add a button which saves the post then executes a function
- How to make animated intro?
- Getting custom posts by post id from cutomizer text input
- Disabling Customizer Selective Refresh shortcut icons for selected controls
- StoreFront product pages: Turn the Short Description section into a kindred tab section [closed]
- Zoom on custom theme without child
- Changing a slider to a grid [closed]
- Custom Navigation build using wp_nav_menu and walker
- Using My Own Classes On Wp Unit Tests
- Page-loop is looping content from custom loops on the same site. How to avoid that?
- How to place HTML tags in content from the_content()?
- The Content is not Wraping in tag
- Integrate WooCommerce theme with a WordPress theme [closed]
- How do you use WordPress for a website that’s not in a blog format?
- Replace site title with logo when logo is uploaded in customizer using
- How to transfer one domain to another domain without losing theme options (customizer)?
- How can I prevent posts with no title showing up in my query?
- How to make theme configurable
- Extending Twenty Eleven Theme
- Templates without a loop, best practice?
- CSS added through customizer neglects the need of a child theme?
- Clearing dummy data before launch
- WordPress Load Only Page Text
- How to call a widget in a loop at a specific iteration value?
- How to add custom page elements to the WYSIWYG editor?
- Using the media library for theme customization
- My contact form – I’ve changed the source code but the changes are not being applied
- How can I sort my loop based on meta data, using a form?
- 1 post per category on homepage and counting those posts
- Exclude parent categories from the_category() within the loop
- Show only pages you are author of
- How do I make my terms for each product display via foreach loop? (woocommerce)
- WordPress Insert ads after every 5th post
- White screen of death on index.php page 3 and above?
- WordPress theme files Organization
- What is difference between add_theme_support and Theme Customization API?
- my ajax wont sent the data, please correct my code
- Is hand coding required at all?
- Text View (Code View) in WordPress Customizer TinyMCE Editor
- control posts order by select option
- What is the best practice workflow for new website overhaul and keeping current SEO ranking? [closed]
- Add a customize control depending wich radio setting is checked
- WordPress Customizer Help with FontAwesome Icon
- Undefined index: custom_sidebars
- Strip HTML tags on custom code from the_content
- How to prevent XSS attack in wordpress theme?
- page.php is not called when I load a Page
- Loop through all posts, show attachment if there
- Tags interfering with next_post_link();
- Theme Option’s Save Button is not working
- Checking conditionals
- Confused on loading page content
- All post ids are the same after this query but rewind_posts() does not seem to work here?
- Why does the first loop take arguments from the second loop?
- How to defeat “Blog pages show at most __ posts” setting in the loop?
- WordPress Loop with Custom Post Type for Bootstrap Accordion [closed]
- Why am I getting posts back when I shouldnt
- Best practice to create required pages
- Is there any reason that other theme elements (such as nav menus) shouldn’t be within the loop?
- How to split the site’s layout without damaging this layout? [closed]
- Multiple content areas with Gutenberg – Transparent areas mid content
- Return the_content() with custom div class for a subset of posts