How we fetch custom meta field output in query loop
-
Hello,
I need help for fetching custom meta field in query loop.
I have created custom post type and created meta field in it.
and i want to getting this via query loop block in wordpress 5.9 version.
created new team-grid-query.php file in pattern folder and added “meta_value”:”facebook” parameter.
inc > pattern > team-grid-query.php<?php /** * Team Grid of posts block pattern */ return array( 'title' => __( 'Team Grid of posts', 'askmoneytheme' ), 'categories' => array( 'query' ), 'blockTypes' => array( 'core/query' ), 'content' => '<!-- wp:query {"query":{"offset":0,"postType":"contributors","meta_value":"facebook","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","sticky":"","perPage":12},"displayLayout":{"type":"flex","columns":3},"align":"wide","layout":{"inherit":true}} --> <div class="wp-block-query alignwide"><!-- wp:post-template {"align":"wide"} --> <!-- wp:post-featured-image {"isLink":true,"width":"100%","height":"318px"} /--> <!-- wp:post-featured-image {"isLink":true,"width":"100%","height":"318px"} /--> <!-- wp:post-title {"isLink":true,"fontSize":"x-large"} /--> <!-- wp:post-excerpt /--> <!-- wp:post-date {"format":"F j, Y","isLink":true,"fontSize":"small"} /--> <!-- /wp:post-template --> <!-- wp:separator {"align":"wide","className":"is-style-wide"} --> <hr class="wp-block-separator alignwide is-style-wide"/> <!-- /wp:separator --> <!-- wp:query-pagination {"paginationArrow":"arrow","align":"wide","layout":{"type":"flex","justifyContent":"space-between"}} --> <!-- wp:query-pagination-previous {"fontSize":"small"} /--> <!-- wp:query-pagination-numbers /--> <!-- wp:query-pagination-next {"fontSize":"small"} /--> <!-- /wp:query-pagination --></div> <!-- /wp:query -->', );
Thanks in advance
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How we fetch custom meta field output in query loop’ is closed to new replies.