• Resolved teodorsavic

    (@teodorsavic)


    Hi,
    Is there a possibility to leave Alt & Title Text field empty? When I create a gallery and upload images, all Alt & Title Texts are created. For many galleries I just upload images with generic filenames (e.g. 125611261.jpg) so the generated Alt Text is “124511261” and I don’t want that to be displayed above the image in Image Browser view. For some other galleries I enter the Alt Texts for some images and I need them to be shown above the image and for some images I don’t need alt text so I don’t want them shown above the image (so adding another, edited ImageBrowser is not an option).
    The only right solution for me would be if I could delete the AltText in Manage Gallery and everything would be fine.
    Is it possible? Any help?

    https://ww.wp.xz.cn/plugins/nextgen-gallery/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor photocrati

    (@photocrati)

    @teodorsavic – I would actually suggest using a custom template that does not display the “Alt & Title text” field, or more generically use some custom CSS to hide that detail.

    Thanks!

    – Cais.

    Thread Starter teodorsavic

    (@teodorsavic)

    Thank you very much for your response.
    I actually used a multiple if conditions combined with strpos and strlen and managed to make it work for me in 99% situations.
    I will write it here just in case someone has a similar problem.
    In nextgen_basic_imagebrowser.php instead of:
    <h3><?php echo esc_attr($image->alttext); ?></h3>
    insert this:

    <h3><?php
         $a = $image->alttext;
         if ((strpos($a,'-') !== false) or (strpos($a,'_') !== false)){
         } else {
         echo $a;
         }
         ?></h3>

    This code will display all the Alt/Title Texts that you entered/edited in Manage Gallery and won’t display automatically created Alt/Title Texts (e.g. my-image-1.jpg) if you didn’t enter any Alt Text yourself.
    It probably isn’t the most elegant solution and probably won’t work for everybody (depending on how you formatted your Titles) but it works for me.

    Plugin Contributor photocrati

    (@photocrati)

    @teodorsavic – Thanks for sharing your code snippet.

    – Cais.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Empty Alt & Title Text field’ is closed to new replies.