diff --git a/includes/class-displayfeaturedimagegenesis-settings.php b/includes/class-displayfeaturedimagegenesis-settings.php
index c462b0d..dfd3bf9 100644
--- a/includes/class-displayfeaturedimagegenesis-settings.php
+++ b/includes/class-displayfeaturedimagegenesis-settings.php
@@ -235,10 +235,7 @@ class Display_Featured_Image_Genesis_Settings {
if ( ! is_numeric( $this->displaysetting['default'] ) ) {
$id = Display_Featured_Image_Genesis_Common::get_image_id( $this->displaysetting['default'] );
}
- $preview = wp_get_attachment_image_src( absint( $id ), 'medium' );
- echo '
';
- printf( '

', esc_url( $preview[0] ) );
- echo '
';
+ echo wp_kses_post( $this->render_image_preview( $id ) );
}
echo '';
printf( '',
@@ -348,10 +345,8 @@ class Display_Featured_Image_Genesis_Settings {
if ( ! is_numeric( $this->displaysetting['post_type'][ $post_type ] ) ) {
$id = Display_Featured_Image_Genesis_Common::get_image_id( $this->displaysetting['post_type'][ $post_type ] );
}
- $preview = wp_get_attachment_image_src( absint( $id ), 'medium' );
- echo '';
- echo '
 . ')
';
- echo '
';
+
+ echo wp_kses_post( $this->render_image_preview( $id ) );
}
echo '';
@@ -372,6 +367,21 @@ class Display_Featured_Image_Genesis_Settings {
}
+ /**
+ * display image preview
+ * @param variable $id featured image ID
+ * @return $image image preview
+ *
+ * @since x.y.z
+ */
+ public function render_image_preview( $id ) {
+ $preview = wp_get_attachment_image_src( absint( $id ), 'medium' );
+ $image = '';
+ $image .= '
 . ')
';
+ $image .= '
';
+ return $image;
+ }
+
/**
* Save extra taxonomy fields callback function.
* @param term id $term_id the id of the term
diff --git a/includes/class-displayfeaturedimagegenesis-taxonomies.php b/includes/class-displayfeaturedimagegenesis-taxonomies.php
index 4e3f248..4a45102 100644
--- a/includes/class-displayfeaturedimagegenesis-taxonomies.php
+++ b/includes/class-displayfeaturedimagegenesis-taxonomies.php
@@ -57,10 +57,7 @@ class Display_Featured_Image_Genesis_Taxonomies {
if ( ! is_numeric( $displaysetting['term_image'] ) ) {
$id = Display_Featured_Image_Genesis_Common::get_image_id( $displaysetting['term_image'] );
}
- $preview = wp_get_attachment_image_src( absint( $id ), 'medium' );
- echo '';
- printf( '

', esc_url( $preview[0] ) );
- echo '
';
+ echo wp_kses_post( Display_Featured_Image_Genesis_Settings::render_image_preview( $id ) );
}
echo '';
printf( '',