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

Feature/issue 48/change single post inner blocks more blocks #54

Merged

Conversation

mogmarsh
Copy link
Collaborator

Creates more custom blocks to use as InnerBlocks. See #50

Base automatically changed from feature/issue-48/change-single-post-inner-blocks to develop December 1, 2023 17:01
Copy link
Member

@attackant attackant left a comment

Choose a reason for hiding this comment

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

A few suggestions 🐙

*/
registerBlockType(
/* @ts-expect-error Provided types are inaccurate to the actual plugin API. */
metadata,
Copy link
Member

Choose a reason for hiding this comment

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

What's the issue here?

$wp_newsletter_builder_block_post = $block->context['postId'] ?? null;

$wp_newsletter_builder_block_post = get_post( $wp_newsletter_builder_block_post );
if ( empty( $wp_newsletter_builder_block_post ) || ! $wp_newsletter_builder_block_post ) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if ( empty( $wp_newsletter_builder_block_post ) || ! $wp_newsletter_builder_block_post ) {
if ( empty( $wp_newsletter_builder_block_post ) ) {

if ( empty( $wp_newsletter_builder_block_post ) || ! $wp_newsletter_builder_block_post ) {
return;
}
$wp_newsletter_builder_excerpt = ! empty( $attributes['overrideExcerpt'] ) ? $attributes['overrideExcerpt'] : get_the_excerpt( $wp_newsletter_builder_block_post );
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$wp_newsletter_builder_excerpt = ! empty( $attributes['overrideExcerpt'] ) ? $attributes['overrideExcerpt'] : get_the_excerpt( $wp_newsletter_builder_block_post );
$wp_newsletter_builder_excerpt = $attributes['overrideExcerpt'] ?? get_the_excerpt($wp_newsletter_builder_block_post);

$wp_newsletter_builder_block_post = $block->context['postId'] ?? null;

$wp_newsletter_builder_block_post = get_post( $wp_newsletter_builder_block_post );
if ( empty( $wp_newsletter_builder_block_post ) || ! $wp_newsletter_builder_block_post ) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if ( empty( $wp_newsletter_builder_block_post ) || ! $wp_newsletter_builder_block_post ) {
if ( empty( $wp_newsletter_builder_block_post ) ) {

if ( empty( $wp_newsletter_builder_block_post ) || ! $wp_newsletter_builder_block_post ) {
return;
}
$wp_newsletter_builder_byline = ! empty( $attributes['overrideByline'] ) ? $attributes['overrideByline'] : get_byline( $wp_newsletter_builder_block_post );
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$wp_newsletter_builder_byline = ! empty( $attributes['overrideByline'] ) ? $attributes['overrideByline'] : get_byline( $wp_newsletter_builder_block_post );
$wp_newsletter_builder_byline = $attributes['overrideByline'] ?? get_byline($wp_newsletter_builder_block_post);

@mogmarsh mogmarsh merged commit 03f66a1 into develop Jan 17, 2024
7 checks passed
@mogmarsh mogmarsh deleted the feature/issue-48/change-single-post-inner-blocks-more-blocks branch January 17, 2024 02:31
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