Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including pattern and template part related to query doesnot work #4

Closed
codersantosh opened this issue Sep 27, 2024 · 0 comments · Fixed by #5
Closed

Including pattern and template part related to query doesnot work #4

codersantosh opened this issue Sep 27, 2024 · 0 comments · Fixed by #5
Assignees

Comments

@codersantosh
Copy link
Owner

Found original issue:

WordPress/gutenberg#48296
x3p0-dev/x3p0-ideas#1 (comment)

Need to change from:

<?php
/**
 * Title: Query Grid
 * Slug: wp-block-theme-boilerplate/query-grid
 * Categories: query
 * Block Types: core/query
 * Description: Display a query block in a grid layout.
 *
 * @package    Wp_Block_Theme_Boilerplate
 * @subpackage Wp_Block_Theme_Boilerplate/patterns
 * @since      1.0.0
 */

?>
<!-- wp:query {"query":{"inherit":true,"postType":"post"},"align":"wide","layout":{"type":"constrained"}} -->
<div class="wp-block-query alignwide"><!-- wp:post-template {"align":"wide","layout":{"type":"grid","columnCount":2}} -->

<!-- wp:post-title {"isLink":true} /-->

<!-- wp:pattern {"slug":"wp-block-theme-boilerplate/post-meta"} /-->

<!-- wp:post-featured-image {"isLink":true,"width":"100%","height":"clamp(15vw, 30vh, 400px)","align":"wide","style":{"spacing":{"margin":{"bottom":"20px"}}}} /-->

<!-- wp:post-excerpt {"moreText":""} /-->

<!-- wp:spacer {"height":"40px"} -->
<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- /wp:post-template -->

<!-- wp:pattern {"slug":"wp-block-theme-boilerplate/pagination"} /-->
<!-- wp:pattern {"slug":"wp-block-theme-boilerplate/hidden-query-no-results"} /-->

</div>
<!-- /wp:query -->

To:

<?php
/**
 * Title: Query Grid
 * Slug: patterns-store-front/query-grid
 * Categories: query
 * Block Types: core/query
 * Description: Display a query block in a grid layout.
 *
 * @package    Patterns_Store_Front
 * @subpackage Patterns_Store_Front/patterns
 * @since      1.0.0
 */

?>
<!-- wp:query {"query":{"inherit":true},"align":"wide","layout":{"type":"constrained"}} -->
<div class="wp-block-query alignwide"><!-- wp:post-template {"align":"wide","layout":{"type":"grid","columnCount":2}} -->

<!-- wp:post-title {"isLink":true} /-->

<!-- wp:pattern {"slug":"patterns-store-front/post-meta"} /-->

<!-- wp:post-featured-image {"isLink":true,"width":"100%","height":"clamp(15vw, 30vh, 400px)","align":"wide","style":{"spacing":{"margin":{"bottom":"20px"}}}} /-->

<!-- wp:post-excerpt {"moreText":""} /-->

<!-- wp:spacer {"height":"40px"} -->
<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- /wp:post-template -->

<?php
	// Need to include from PHP since wp:pattern not working
	// <!-- wp:pattern {"slug":"patterns-store-front/pagination"} /-->
	// <!-- wp:pattern {"slug":"patterns-store-front/hidden-query-no-results"} /-->
	require 'pagination.php';
	require 'hidden-query-no-results.php';
?>

</div>
<!-- /wp:query -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant