Skip to content

Commit

Permalink
Issue #6 - different message when slug attribute is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed May 7, 2021
1 parent 176b0fa commit f85746f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions includes/template-part.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,15 @@ function thisis_render_block_core_template_part( $attributes ) {

if ( is_null( $content ) && is_user_logged_in() ) {
//print_r( $attributes );
return sprintf(
/* translators: %s: Template part slug. */
__( 'Template part has been deleted or is unavailable: %s' ),
$attributes['slug']
);
if ( isset( $attributes['slug'])) {
return sprintf(
/* translators: %s: Template part slug. */
__('Template part has been deleted or is unavailable: %s'),
$attributes['slug']
);
} else {
return __('No slug given for template part block');
}
}

if ( isset( $seen_ids[ $template_part_id ] ) ) {
Expand Down

0 comments on commit f85746f

Please sign in to comment.