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

Link Wrapper: Default to the permalink if the url isn't defined #655

Draft
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

adamwoodnz
Copy link
Contributor

This enables the block to be used in query loops, for example the Make homepage team grid.

Uses server side rendering so that the permalink can be easily looked up.

@adamwoodnz adamwoodnz force-pushed the try/link-wrapper-use-post-permalink branch from 5fdbaeb to 5ac80b3 Compare October 3, 2024 02:40
@@ -30,6 +30,9 @@
"padding": true
}
},
"dimensions": {
"minHeight": true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow configuring the wrapper to fill the grid item.

This enables the block to be used in query loops, for example the Make homepage team grid
@adamwoodnz adamwoodnz force-pushed the try/link-wrapper-use-post-permalink branch from 5ac80b3 to 05ff02f Compare October 3, 2024 02:42
@ryelle
Copy link
Contributor

ryelle commented Oct 7, 2024

I think changing the save function like this will cause invalid block errors in the editor. But the render function would still work, $content should be the link markup. Maybe that + WP_HTML_Tag_Processor to update the href attribute if no url?

I've done similar with just str_replace on the theme directory, so this would definitely be useful 🙂

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 this pull request may close these issues.

2 participants