Add alt tags to featured images in admin

This commit is contained in:
Robin Cornett
2015-03-02 11:36:01 -05:00
parent 2da37bbd79
commit 695532491f
@@ -87,13 +87,14 @@ class Display_Featured_Image_Genesis_Admin {
*/
public function manage_taxonomy_column( $value, $column, $term_id ) {
$t_id = $term_id;
$taxonomy = get_current_screen()->taxonomy;
if ( 'featured_image' === $column ) {
$term_meta = get_option( "displayfeaturedimagegenesis_$t_id" );
$term_meta = get_option( "displayfeaturedimagegenesis_$term_id" );
if ( ! empty( $term_meta['term_image'] ) ) {
$alt_tag = get_term( $term_id, $taxonomy )->name;
$id = Display_Featured_Image_Genesis_Common::get_image_id( $term_meta['term_image'] );
$preview = apply_filters( 'display_featured_image_genesis_admin_term_thumbnail', wp_get_attachment_image_src( $id, 'thumbnail' ), $id );
echo '<img src="' . $preview[0] . '" width="60" />';
echo '<img src="' . $preview[0] . '" alt="' . $alt_tag . '" />';
}
}
@@ -111,9 +112,9 @@ class Display_Featured_Image_Genesis_Admin {
if ( 'featured_image' === $column ) {
$id = get_post_thumbnail_id( $post_id );
$preview = apply_filters( 'display_featured_image_genesis_admin_post_thumbnail', wp_get_attachment_image_src( $id, array( 60, 60 ) ), $id );
$preview = apply_filters( 'display_featured_image_genesis_admin_post_thumbnail', wp_get_attachment_image_src( $id, 'thumbnail' ), $id );
if ( $id ) {
echo '<img src="' . $preview[0] . '" width="60" />';
echo '<img src="' . $preview[0] . '" alt="' . the_title_attribute( 'echo=0' ) . '" />';
}
}
@@ -127,8 +128,8 @@ class Display_Featured_Image_Genesis_Admin {
$screen = get_current_screen();
if ( in_array( $screen->base, array( 'edit', 'edit-tags' ) ) ) { ?>
<style type="text/css">
.column-featured_image { width:105px; }
.column-featured_image img { margin: 0 auto; display: block; }
.column-featured_image { width: 105px; }
.column-featured_image img { margin: 0 auto; display: block; height: auto; width: auto; max-width: 60px; max-height: 80px; }
</style> <?php
}
}