admin管理员组

文章数量:1122846

I am using WordPress 6+ with a full-site editor theme.

I need to add the post slug as the id for each post in the query loop block.

Must I extend the block for such a trivial task?

I am using WordPress 6+ with a full-site editor theme.

I need to add the post slug as the id for each post in the query loop block.

Must I extend the block for such a trivial task?

Share Improve this question asked Jan 8, 2024 at 19:47 Mike RitterMike Ritter 494 bronze badges 2
  • I don't see any way to do it in the UI. Can I ask why you need it? – Jacob Peattie Commented Jan 11, 2024 at 16:23
  • 1 I want to be able to add internal links so I don’t have to link to the page and then someone scroll down to the block. – Mike Ritter Commented Jan 12, 2024 at 22:47
Add a comment  | 

1 Answer 1

Reset to default 1

I spent ages looking for this, then discovered that the otter blocks plugin (it was installed with my theme but it's a free plugin) allows the use of dynamic values in any block. I don't think the post-slug as an option but I used the post-id. I swapped to the code editor to add an id to the group div containing post details (ie inside the query block): id="{otterDynamic?type=postID&context=query}" and it works great. Unfortunately The documentation of this in otter blocks is hard to find! https://docs.themeisle.com/article/1736-how-to-add-magic-tags-to-display-dynamic-values

本文标签: full site editingHow do I add unique id values to query loop block post template tags