$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Why does my block theme only show one post on the front page, and how can I display all posts in templatesindex.html?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Why does my block theme only show one post on the front page, and how can I display all posts in templatesindex.html?

matteradmin10PV0评论
<!-- wp:group {"className":"wrapper inset-layout","layout":{"type":"default"}} -->
<div class="wp-block-group wrapper inset-layout">
    <!-- wp:group {"className":"division","layout":{"type":"default"}} -->
    <div class="wp-block-group division">
        <!-- wp:template-part {"slug":"sidebar"} /-->

        <!-- wp:group {"className":"main","layout":{"type":"default"}} -->
        <div class="wp-block-group main">
            <!-- wp:group {"className":"stack","layout":{"type":"default"}} -->
            <div class="wp-block-group stack">
                <!-- wp:group {"className":"primary-content","layout":{"type":"default"}} -->
                <div class="wp-block-group primary-content">
                    <!-- wp:query -->
                    <!-- wp:post-title {"level":1,"isLink":true} /-->
                    <!-- wp:post-excerpt /-->
                    <!-- wp:query /-->
                </div>
                <!-- /wp:group -->
                <!-- wp:eternaltwentyfifteen/post-footer /-->
            </div>
            <!-- /wp:group -->
        </div>
        <!-- /wp:group -->
    </div>
    <!-- /wp:group -->
</div>
<!-- /wp:group -->

The above doesnt archive all post on front page, but just one latst posts; I thought block themes are well structured and templates/index.html WordPress will do all the heavy weight lifting, but that has not happened in this case.

What changes should I make to templates/index.html to populate all the posts? Should I hae Custom Query Loop in this — templates/index.html

<!-- wp:group {"className":"wrapper inset-layout","layout":{"type":"default"}} -->
<div class="wp-block-group wrapper inset-layout">
    <!-- wp:group {"className":"division","layout":{"type":"default"}} -->
    <div class="wp-block-group division">
        <!-- wp:template-part {"slug":"sidebar"} /-->

        <!-- wp:group {"className":"main","layout":{"type":"default"}} -->
        <div class="wp-block-group main">
            <!-- wp:group {"className":"stack","layout":{"type":"default"}} -->
            <div class="wp-block-group stack">
                <!-- wp:group {"className":"primary-content","layout":{"type":"default"}} -->
                <div class="wp-block-group primary-content">
                    <!-- wp:query -->
                    <!-- wp:post-title {"level":1,"isLink":true} /-->
                    <!-- wp:post-excerpt /-->
                    <!-- wp:query /-->
                </div>
                <!-- /wp:group -->
                <!-- wp:eternaltwentyfifteen/post-footer /-->
            </div>
            <!-- /wp:group -->
        </div>
        <!-- /wp:group -->
    </div>
    <!-- /wp:group -->
</div>
<!-- /wp:group -->

The above doesnt archive all post on front page, but just one latst posts; I thought block themes are well structured and templates/index.html WordPress will do all the heavy weight lifting, but that has not happened in this case.

What changes should I make to templates/index.html to populate all the posts? Should I hae Custom Query Loop in this — templates/index.html

Share Improve this question asked Apr 14 at 9:51 WordCentWordCent 1,9646 gold badges34 silver badges60 bronze badges 2
  • 3 shouldn't there be a post template block inside the query block? I would expect to see <!-- wp:post-template inside the query block markup. Note that block markup is intended to be generated in the editor, manual modifications can lead to issues like this as well as block validation errors – Tom J Nowell Commented Apr 14 at 12:54
  • 1 @TomJNowell Well spotted - writing from a mobile I didnt notice it was missing
Post a comment

comment list (0)

  1. No comments so far