admin管理员组文章数量:1279117
Before Gutenberg I added meta_fields like "_my_integer_value" and added them to the post. I could query with something like this:
$args = array(
'post_type' => 'post',
'orderby' => array( 'meta_value_num' => 'DESC', 'date' => 'DESC' ),
'meta_key' => '_my_integer_value',
'posts_per_page' => '300',
'order' => 'DESC'
);
Now I made a block that saves its content to the html of the block.
block.json
"attributes": {
"my_integer_value": {
"type": "string",
"source": "html",
"selector": "span.value",
"default": 5
}
},
What is the best practice to use blocks and make information in them sortable in queries? Can I save the contents to the post meta somehow? Is there another option to save content in block that can be queried? This allows only for queries for posts that have this block but I can't sort them: WP Query by Gutenberg block and get its attribute
本文标签: Gutenberg Block Query for posts with blocks and sort by attributes
版权声明:本文标题:Gutenberg Block: Query for posts with blocks and sort by attributes 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741214200a2359728.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论