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

Query Loop / Post Template block: additional grid view layout options #61298

Open
davewhitley opened this issue May 1, 2024 · 3 comments · May be fixed by #61453
Open

Query Loop / Post Template block: additional grid view layout options #61298

davewhitley opened this issue May 1, 2024 · 3 comments · May be fixed by #61453
Assignees
Labels
[Block] Post Template Affects the Post Template Block [Block] Query Loop Affects the Query Loop Block Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@davewhitley
Copy link
Contributor

What problem does this address?

It is currently not possible to define column-gap or row-gap on the Post Template block. This seems like a trivial addition that can unlock a lot more layout options with the Query Loop. This can be done using custom CSS with one line of CSS.

Screenshot 2024-05-01 at 4 23 05 PM

We have block spacing, but that adjusts both row and column gaps together.

Real example: I want to adjust the column gap here and not affect the row gap:

Screenshot 2024-05-01 at 4 33 30 PM

What is your proposed solution?

Settings for row and column gaps in the block sidebar. I would also be fine if they had to reside in the Dimension settings.

Related: #25462 (I did not comment there because the scope is much bigger on that issue)

@davewhitley davewhitley added [Type] Enhancement A suggestion for improvement. Good First Issue An issue that's suitable for someone looking to contribute for the first time [Block] Query Loop Affects the Query Loop Block [Block] Post Template Affects the Post Template Block labels May 1, 2024
@realthemes
Copy link

realthemes commented May 2, 2024

I implemented something similar in the extended core/post-template block for my theme, but due to insufficient documentation, this plugin works poorly. I even lost the place in the documentation where the issue of creating a custom layout for the Post Template was covered, if anyone knows, please tell me. There was something there: about the attribute
layout: { default: { type: 'custom' } }

Here my results, plugin allow me to set Gap, also it allow to set Columns count for every breakpoint, like Mobile, Tablet or Desktop.

Screenshot

@realthemes
Copy link

realthemes commented May 2, 2024

Just improved my block plugin a bit to be able to set the spacing between rows and columns independently. But I still need a suggestion on how to set my own attribute layout type, here is my implementation:

<ToolbarButton
	icon={icon}
	label={__(
		'Responsive grid view',
		'responsive-post-template'
	)}
	isActive={
		layout &&
		layout.default &&
		layout.default.type === 'custom' &&
		layout.type !== 'grid' &&
		layout.type !== 'default'
	}
	onClick={() => {
		setAttributes({
			layout: { default: { type: 'custom' } },
		});
	}}
/>

With this code I still get the default layout classnames that come with WordPress like "is-layout-flow wp-block-post-template-is-layout-flow" etc and I found workaround to filter them using PHP filter on frontend. This solution is not perfect, and I would like to improve it.

Screenshot

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label May 7, 2024
@patil-vipul
Copy link

Hi, @davewhitley, raised a PR to add individual controls for Column and Row gap. #61453.
Let me know if it needs improvement.

Thanks!

cc: @realthemes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Template Affects the Post Template Block [Block] Query Loop Affects the Query Loop Block Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants