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

Restrict gutenberg block next post & previous post to same category #47090

Closed
laoyingzhige opened this issue Jan 11, 2023 · 2 comments · Fixed by #48912
Closed

Restrict gutenberg block next post & previous post to same category #47090

laoyingzhige opened this issue Jan 11, 2023 · 2 comments · Fixed by #48912
Assignees
Labels
[Block] Post Navigation Link Affects the Post Navigation Link Block [Feature] Extensibility The ability to extend blocks or the editing experience [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@laoyingzhige
Copy link

What problem does this address?

I am using gutenberg default blocks [next post], [previous post] in the template.

but,

In gutenberg editor,

It don’t have the parameters to set to restrict post navigation to the same category.

What is your proposed solution?

I think many wordpress users need this feature to restrict [next post], [previous post] navigation to the same category.

So, I suggest to add this feature.

Do you agree? friends?

Thanks very much.

@ntsekouras ntsekouras added [Type] Enhancement A suggestion for improvement. [Block] Post Navigation Link Affects the Post Navigation Link Block labels Jan 12, 2023
@justintadlock
Copy link
Contributor

@laoyingzhige Thanks for filing this ticket. Your original support thread was on my list. Nice to see it already here. :)

For more context, both the previous_post_link() and next_post_link() PHP functions allow for several category/taxonomy-related options that their block equivalents do not currently have:

function previous_post_link(
	$format = '« %link',
	$link = '%title',
	$in_same_term = false,
	$excluded_terms = '',
	$taxonomy = 'category'
)

Since both of the blocks are just wrappers for the PHP function, it should be relatively straightforward to transfer the $in_same_term and $taxonomy parameters to block settings. This is also a somewhat common request based on my own experience in the past.

Function reference:

@carolinan carolinan self-assigned this Feb 24, 2023
@carolinan carolinan added the [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. label Feb 24, 2023
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Mar 8, 2023
@masteradhoc
Copy link
Contributor

+1 @carolinan nice work! when will this be added to gutenberg? :)

@bph bph added the [Feature] Extensibility The ability to extend blocks or the editing experience label Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Navigation Link Affects the Post Navigation Link Block [Feature] Extensibility The ability to extend blocks or the editing experience [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
Development

Successfully merging a pull request may close this issue.

6 participants