admin管理员组

文章数量:1122846

For example, you can create a posts template within the site editor, but how do you make it so that the content for each respective single post displays dynamically?

Here's my single post template code:

<!-- wp:heading -->
<h2 class="wp-block-heading"></h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

I know that I can create PHP templates on the back-end, but do dynamic content tags exist in this context to insert post title and post content to my template on the front-end?

For example, you can create a posts template within the site editor, but how do you make it so that the content for each respective single post displays dynamically?

Here's my single post template code:

<!-- wp:heading -->
<h2 class="wp-block-heading"></h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

I know that I can create PHP templates on the back-end, but do dynamic content tags exist in this context to insert post title and post content to my template on the front-end?

Share Improve this question asked Apr 21, 2024 at 23:15 WPdummyWPdummy 235 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Two block markup examples are the post-title block:

<!-- wp:post-title /-->

and the post-content block:

<!-- wp:post-content /-->

that you can use in your single post template.

See more here under the Query Loop list item:

https://wordpress.org/documentation/article/blocks-list/#theme-blocks

本文标签: postsIs it possible to create dynamic templates for block themes directly from the site editor