-
Notifications
You must be signed in to change notification settings - Fork 1
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
Issue-48: Change Newsletter Single Post to use inner blocks #50
Issue-48: Change Newsletter Single Post to use inner blocks #50
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐙
if ( empty( $wp_newsletter_builder_block_post ) || ! $wp_newsletter_builder_block_post ) { | ||
return; | ||
} | ||
$wp_newsletter_builder_post_title = ! empty( $attributes['overrideTitle'] ) ? $attributes['overrideTitle'] : $wp_newsletter_builder_block_post->post_title; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be:
$wp_newsletter_builder_post_title = $attributes['overrideTitle'] ?? $wp_newsletter_builder_block_post->post_title;
src/class-block-modifications.php
Outdated
if ( ! empty( $block['attrs']['overrideUrl'] ) ) { | ||
add_filter( | ||
'post_link', | ||
function() use ( $block ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool I didn't know about use
…hange-single-post-inner-blocks
…ost-inner-blocks' into feature/issue-48/change-single-post-inner-blocks
name: Change Newsletter Single Post to use inner blocks
about: Convert the display logic of Newsletter Single Post block to utilize inner blocks and context.
title: ''
labels: ''
assignees: ''
This PR switches the Newsletter Single Post block to use InnerBlocks and converts the Post Title and Post Featured Image to new blocks. We need to use custom blocks to allow for overrides. There will be more custom blocks in a future PR.
Issue Number
#48
Description
Currently, the logic for displaying a post is all inside the Newsletter Single Post block and powered by the show____ and order attributes. We should change this to use inner blocks and context. Hopefully the core inner blocks will work, but if not, we should create the necessary inner blocks. Display should still use the same markup, as that has been deemed "email safe".
Use Case
Using inner blocks will give editors more control over their templates and allow developers to create their own blocks to add to the layout to display an eyebrow, for instance.
Additional Context
This change will probably also allow us to use it in conjunction with the core Query Loop block or WP Curate query block, which will allow some sections of a newsletter to be more automated. See alleyinteractive/wp-newsletter-builder#26.