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

Add option to the Largo Recent Posts widget to toggle the byline date #1364

Merged
merged 1 commit into from
Oct 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions inc/widgets/largo-recent-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ function update( $new_instance, $old_instance ) {
$instance['excerpt_display'] = sanitize_key( $new_instance['excerpt_display'] );
$instance['num_sentences'] = intval( $new_instance['num_sentences'] );
$instance['show_byline'] = ! empty($new_instance['show_byline']);
$instance['hide_byline_date'] = ! empty($new_instance['hide_byline_date']);
$instance['show_top_term'] = ! empty($new_instance['show_top_term']);
$instance['show_icon'] = ! empty($new_instance['show_icon']);
$instance['cat'] = intval( $new_instance['cat'] );
Expand All @@ -156,6 +157,7 @@ function form( $instance ) {
'excerpt_display' => 'num_sentences',
'num_sentences' => 2,
'show_byline' => '',
'hide_byline_date' => '',
'show_top_term' => '',
'show_icon' => '',
'cat' => 0,
Expand All @@ -169,6 +171,7 @@ function form( $instance ) {
$instance = wp_parse_args( (array) $instance, $defaults );
$duplicates = $instance['avoid_duplicates'] ? 'checked="checked"' : '';
$showbyline = $instance['show_byline'] ? 'checked="checked"' : '';
$hidebylinedate = $instance['hide_byline_date'] ? 'checked="checked"' : '';
$show_top_term = $instance['show_top_term'] ? 'checked="checked"' : '';
$show_icon = $instance['show_icon'] ? 'checked="checked"' : '';
?>
Expand Down Expand Up @@ -224,6 +227,10 @@ function form( $instance ) {
<input class="checkbox" type="checkbox" <?php echo $showbyline; ?> id="<?php echo $this->get_field_id( 'show_byline' ); ?>" name="<?php echo $this->get_field_name( 'show_byline' ); ?>" /> <label for="<?php echo $this->get_field_id( 'show_byline' ); ?>"><?php _e( 'Show byline on posts?', 'largo' ); ?></label>
</p>

<p>
<input class="checkbox" type="checkbox" <?php echo $hidebylinedate; ?> id="<?php echo $this->get_field_id( 'hide_byline_date' ); ?>" name="<?php echo $this->get_field_name( 'hide_byline_date' ); ?>" /> <label for="<?php echo $this->get_field_id( 'hide_byline_date' ); ?>"><?php _e( 'Hide the publish date in the byline?', 'largo' ); ?></label>
</p>

<p>
<input class="checkbox" type="checkbox" <?php echo $show_top_term; ?> id="<?php echo $this->get_field_id( 'show_top_term' ); ?>" name="<?php echo $this->get_field_name( 'show_top_term' ); ?>" /> <label for="<?php echo $this->get_field_id( 'show_top_term' ); ?>"><?php _e( 'Show the top term on posts?', 'largo' ); ?></label>
</p>
Expand Down
3 changes: 2 additions & 1 deletion partials/widget-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
largo_maybe_top_term();
}


// the thumbnail image (if we're using one)
if ($thumb == 'small') {
$img_location = $instance['image_align'] != '' ? $instance['image_align'] : 'left';
Expand Down Expand Up @@ -35,7 +36,7 @@

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

// the excerpt
Expand Down