mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-19 14:33:32 +09:00
Add alt tags to featured images in admin
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user