Skip to content

Commit

Permalink
Catch some undefined indexes in partials/widget-content.php
Browse files Browse the repository at this point in the history
Part of #1492
  • Loading branch information
benlk committed Dec 18, 2018
1 parent a8caa13 commit 1e421a7
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions partials/widget-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,19 @@
</h5>

<?php // byline on posts
if ( isset( $instance['show_byline'] ) && $instance['show_byline'] == true) { ?>
<span class="byline"><?php echo largo_byline( false, $instance['hide_byline_date'], get_the_ID() ); ?></span>
<?php }
if ( isset( $instance['show_byline'] ) && $instance['show_byline'] == true) {
$hide_byline_date = ( ! empty( $instance['hide_byline_date'] ) ) ? $instance['hide_byline_date'] : true;
?>
<span class="byline"><?php echo largo_byline( false, $hide_byline_date, get_the_ID() ); ?></span>
<?php
}

// the excerpt
if ( $excerpt == 'num_sentences' ) { ?>
<p><?php echo largo_trim_sentences( get_the_content(), $instance['num_sentences'] ); ?></p>
<?php } elseif ( $excerpt == 'custom_excerpt' ) { ?>
<p><?php echo get_the_excerpt(); ?></p>
<?php }
if ( $excerpt == 'num_sentences' ) {
$num_sentences = ( ! empty( $instance['num_sentences'] ) ) ? $instance['num_sentences'] : 2;
?>
<p><?php echo largo_trim_sentences( get_the_content(), $num_sentences ); ?></p>
<?php } elseif ( $excerpt == 'custom_excerpt' ) { ?>
<p><?php echo get_the_excerpt(); ?></p>
<?php
}

0 comments on commit 1e421a7

Please sign in to comment.