diff --git a/includes/class-displayfeaturedimagegenesis-output.php b/includes/class-displayfeaturedimagegenesis-output.php index dc0743f..adcdbbe 100644 --- a/includes/class-displayfeaturedimagegenesis-output.php +++ b/includes/class-displayfeaturedimagegenesis-output.php @@ -50,11 +50,15 @@ class Display_Featured_Image_Genesis_Output { $medium = absint( get_option( 'medium_size_w' ) ); $width = absint( $item->backstretch[1] ); - //* if there is no backstretch image set, or it is too small, die - if ( empty( $item->backstretch ) || $width <= $medium || is_paged() ) { + // check if they have enabled display on subsequent pages + $displaysetting = get_option( 'displayfeaturedimagegenesis' ); + $is_paged = $displaysetting['is_paged']; + + // if there is no backstretch image set, or it is too small, or it's page 2+ and they didn't change the setting, die + if ( empty( $item->backstretch ) || $width <= $medium || ( is_paged() && ! $is_paged ) ) { return; } - //* if the featured image is not part of the content, or we're not on a singular page, carry on + // if the featured image is not part of the content, or we're not on a singular page, carry on if ( false === $item->content || ! is_singular() ) { $css_file = apply_filters( 'display_featured_image_genesis_css_file', plugin_dir_url( __FILE__ ) . 'css/display-featured-image-genesis.css' ); @@ -62,7 +66,7 @@ class Display_Featured_Image_Genesis_Output { $post_types = array(); $force_backstretch = apply_filters( 'display_featured_image_genesis_force_backstretch', $post_types ); - //* check if the image is large enough for backstretch + // check if the image is large enough for backstretch if ( $width > $large || in_array( get_post_type(), $force_backstretch ) ) { wp_enqueue_script( 'displayfeaturedimage-backstretch', plugins_url( '/includes/js/backstretch.js', dirname( __FILE__ ) ), array( 'jquery' ), $version, true ); @@ -73,7 +77,7 @@ class Display_Featured_Image_Genesis_Output { } - //* otherwise it's a large image. + // otherwise it's a large image. elseif ( $width <= $large ) { remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' ); @@ -101,7 +105,12 @@ class Display_Featured_Image_Genesis_Output { $medium = absint( get_option( 'medium_size_w' ) ); $width = absint( $item->backstretch[1] ); - if ( empty( $item->backstretch ) || $width <= $medium || is_paged() ) { + // check if they have enabled display on subsequent pages + $displaysetting = get_option( 'displayfeaturedimagegenesis' ); + $is_paged = $displaysetting['is_paged']; + + // if there is no backstretch image set, or it is too small, or it's page 2+ and they didn't change the setting, die + if ( empty( $item->backstretch ) || $width <= $medium || ( is_paged() && ! $is_paged ) ) { return $classes; } diff --git a/includes/class-displayfeaturedimagegenesis-settings.php b/includes/class-displayfeaturedimagegenesis-settings.php index 4e9041a..6f7fd96 100644 --- a/includes/class-displayfeaturedimagegenesis-settings.php +++ b/includes/class-displayfeaturedimagegenesis-settings.php @@ -74,7 +74,8 @@ class Display_Featured_Image_Genesis_Settings { 'exclude_front' => 0, 'keep_titles' => 0, 'move_excerpts' => 0, - 'feed_image' => 0 + 'is_paged' => 0, + 'feed_image' => 0, ); $this->displaysetting = get_option( 'displayfeaturedimagegenesis', $defaults ); @@ -126,6 +127,14 @@ class Display_Featured_Image_Genesis_Settings { 'display_featured_image_section' ); + add_settings_field( + 'displayfeaturedimagegenesis[is_paged]', + '', + array( $this, 'check_is_paged' ), + 'displayfeaturedimagegenesis', + 'display_featured_image_section' + ); + add_settings_field( 'displayfeaturedimagegenesis[feed_image]', '', @@ -263,6 +272,17 @@ class Display_Featured_Image_Genesis_Settings { echo ''; } + /** + * option to show featured image on page 2+ of blog/archives + * @return 0 1 checkbox + * + * @since 2.2.0 + */ + public function check_is_paged() { + echo ''; + echo ''; + } + /** * option to add images to feed * @return 0 1 checkbox @@ -377,6 +397,8 @@ class Display_Featured_Image_Genesis_Settings { $new_value['move_excerpts'] = $this->one_zero( $new_value['move_excerpts'] ); + $new_value['is_paged'] = $this->one_zero( $new_value['is_paged'] ); + $new_value['feed_image'] = $this->one_zero( $new_value['feed_image'] ); foreach ( $this->post_types as $post_type ) { diff --git a/includes/class-displayfeaturedimagegenesis.php b/includes/class-displayfeaturedimagegenesis.php index 5697d5c..13e1304 100644 --- a/includes/class-displayfeaturedimagegenesis.php +++ b/includes/class-displayfeaturedimagegenesis.php @@ -123,13 +123,20 @@ class Display_Featured_Image_Genesis { ) ); } - //* new setting for titles added in 2.0.0 + // new setting for titles added in 2.0.0 if ( empty( $displaysetting['keep_titles'] ) ) { $this->update_settings( array( 'keep_titles' => 0 ) ); } + // new setting for subsequent pages added in 2.2.0 + if ( empty( $displaysetting['is_paged'] ) ) { + $this->update_settings( array( + 'is_paged' => 0 + ) ); + } + } /**