• Resolved Jochen

    (@tadama)


    Hi I really like your plugin,
    I have added galleries with the plugin. If the featured image does not contain an alt tag then non is displyed in the gallery. I would like to set it either to the titel of the post where its comming from or in my case even a setting to have the same alt tag for all gallery photos could work. Any suggestion?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    Display Posts uses the standard WordPress core function for displaying the image. If you would like to automatically add an alt tag to images that are missing it, you’ll need to apply this to all images in WordPress.

    I haven’t tried any of these, but here are a few tutorials:
    https://isabelcastillo.com/add-title-attribute-wordpress-image-thumbnail
    https://brutalbusiness.com/automatically-set-the-wordpress-image-title-alt-text-other-meta/

    Thread Starter Jochen

    (@tadama)

    Hi Bill, thanks for the quick response! I would prefer not to touch the media library as I work with user generated content. For the archive page we use this snipplet to add the alt tag based on the title of the post. Would something of that sort also work for your gallery? (I am not a developer, its might be an easy change?)

    /**
    * Set alt value to post title for featured images in content archives
    */
    function sk_set_alt_post_title( $attributes ) {
    $attributes[‘alt’] = the_title_attribute( ‘echo=0’ );
    return $attributes;
    }
    add_filter( ‘genesis_attr_entry-image’, ‘sk_set_alt_post_title’ );

    Plugin Author Bill Erickson

    (@billerickson)

    Unfortunately no, that wouldn’t work. You’re using a genesis filter to modify a Genesis function, and Display Posts does not use that Genesis function.

    The first tutorial I linked to above uses the exact same code as yours but applies it to images using the standard WordPress functions for displaying images.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Feature request: alternative alt tag’ is closed to new replies.