Skip to content

Commit

Permalink
Add Featured Image support to Event Countdown widget
Browse files Browse the repository at this point in the history
  • Loading branch information
savvasha committed Mar 30, 2018
1 parent 7cc4ec1 commit 5825cf1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/sportspress-countdowns.php
Expand Up @@ -88,6 +88,13 @@ public function add_settings( $settings ) {
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Featured Image', 'sportspress' ),
'desc' => __( 'Display featured image of event', 'sportspress' ),
'id' => 'sportspress_countdown_show_featured_image',
'default' => 'no',
'type' => 'checkbox',
),
)),

array(
Expand Down
8 changes: 8 additions & 0 deletions templates/countdown.php
Expand Up @@ -21,6 +21,7 @@
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
'link_venues' => get_option( 'sportspress_link_venues', 'no' ) == 'yes' ? true : false,
'show_logos' => get_option( 'sportspress_countdown_show_logos', 'no' ) == 'yes' ? true : false,
'show_feat_image' => get_option( 'sportspress_countdown_show_featured_image', 'no' ) == 'yes' ? true : false,
);
if ( isset( $id ) ):
$post = get_post( $id );
Expand Down Expand Up @@ -75,6 +76,13 @@
?>
<div class="sp-template sp-template-countdown">
<div class="sp-countdown-wrapper">
<?php
if ( $show_feat_image && has_post_thumbnail( $post ) ) {
?>
<h2 class="event-name sp-event-name">
<?php echo get_the_post_thumbnail( $post ); ?>
</h2>
<?php } ?>
<h3 class="event-name sp-event-name">
<?php
if ( $show_logos ) {
Expand Down

1 comment on commit 5825cf1

@savvasha
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should think if the option should be global or per widget!
Currently is set to global.

Please sign in to comment.