Skip to content

Commit

Permalink
Issue #16 - when Template Part Not Found is displayed show informatio…
Browse files Browse the repository at this point in the history
…n for problem determination
  • Loading branch information
bobbingwide committed Nov 9, 2020
1 parent 6dfaf83 commit ff14500
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions template-part.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ function fizzie_load_template_part( $attributes ) {
if ( is_null( $content ) ) {

// $content = fizzie_create_error_block( );
$atts = implode( $attributes );

$html .= '<div>';
$html = 'Template Part Not Found: ' . $slug;
$html .= 'PostId: ' . $postId;
$html .= "Theme:" . $theme;
$html .= $template_part_file_path;
$html .= $atts;
$content = $html;
foreach ( $attributes as $key => $value ) {
$html .= "<div><span>$key</span>: <span>$value</span>";
}
$html .= "<div><span>File path</span>: <span>$template_part_file_path</span></div>";
$html .= '</div>';
$content = $html;

}
return $content;
}
Expand All @@ -55,6 +58,10 @@ function fizzie_load_template_part_by_postId( $postId ) {
$content = $post->post_content;
}
}

if ( !$content ) {
$content = "Template part cannot be loaded by postId: " . $postId;
}
return $content;
}

Expand Down

0 comments on commit ff14500

Please sign in to comment.