Topic: Need to hide ALT tags

When using a gallery created with NextGEN I commonly enter the description and leave the ALT tag (top field, I think that's what it is?), the default, which is often something like "SONY DSC". When adding a WP-Juicebox gallery, both the ALT tag and the description appear, whereas I would like just the description to appear. Is there a way of hiding the ALT tag? I tried searching the Pro options and don't see anything that would obviously do that. Perhaps it's not an ALT tag but rather the title? Either way, I would like to hide it...

For background, I've been using WP-Simpleviewer (Pro) for years and am interested in switching my galleries over (as Steven suggested in another thread). I'm about to purchase Juicebox Pro, and just wanted to test that I can easily switch over my galleries. it looks like I can, which is great, with the above being the only concern.

Re: Need to hide ALT tags

There is no interface control to prevent the ALT tags from being used as image titles but you can disable them with a quick edit to the plugin's 'wp-juicebox.php' file.
Open the 'wp-juicebox/wp-juicebox.php' file in a plain text editor and comment out (or remove) lines 977 to 983 inclusive.
Just change:

$title_element = $dom_doc->createElement('title');
$image_title = $attachment->alttext;
$image_title = $this->line_break($image_title);
$image_title = $this->strip_control_characters($image_title);
$title_text = $dom_doc->createCDATASection($image_title);
$title_element->appendChild($title_text);
$image_element->appendChild($title_element);

... to:

// $title_element = $dom_doc->createElement('title');
// $image_title = $attachment->alttext;
// $image_title = $this->line_break($image_title);
// $image_title = $this->strip_control_characters($image_title);
// $title_text = $dom_doc->createCDATASection($image_title);
// $title_element->appendChild($title_text);
// $image_element->appendChild($title_element);

The leading // comments out a line and it will just be ignored rather than parsed and executed.

(The descriptions will still be used as the image captions.)

Please note that the line numbers above refer to the current version of WP-Juicebox (v1.5.1.1).

Re: Need to hide ALT tags

Thanks for the quick response! Yes, that worked great. Would you consider adding control over this directly in the interface? I'm concerned that I'll forget to re-make the changes when I update. This could potentially be useful to others - one might want to show just the title/alt, just the description, both, or none. Thoughts?

PS: In the meantime I purchased the Pro version.

Re: Need to hide ALT tags

Thanks for the quick response! Yes, that worked great.

You're welcome! I'm glad it worked. Thank you for letting me know.

Would you consider adding control over this directly in the interface?

Please post suggestions for future versions in the Feature Requests forum thread. (You can post suggestions for Juicebox and all official plugins written by ourselves there.)
This keeps all the requests together and ensures that they will not be overlooked by the developers.
I do not know the likelihood of any ideas being implemented in future versions but this is certainly the best place for all ideas.
Thank you!

Re: Need to hide ALT tags

Steven @ Juicebox wrote:

There is no interface control to prevent the ALT tags from being used as image titles but you can disable them with a quick edit to the plugin's 'wp-juicebox.php' file.
Open the 'wp-juicebox/wp-juicebox.php' file in a plain text editor and comment out (or remove) lines 977 to 983 inclusive.
Just change:

$title_element = $dom_doc->createElement('title');
$image_title = $attachment->alttext;
$image_title = $this->line_break($image_title);
$image_title = $this->strip_control_characters($image_title);
$title_text = $dom_doc->createCDATASection($image_title);
$title_element->appendChild($title_text);
$image_element->appendChild($title_element);

... to:

// $title_element = $dom_doc->createElement('title');
// $image_title = $attachment->alttext;
// $image_title = $this->line_break($image_title);
// $image_title = $this->strip_control_characters($image_title);
// $title_text = $dom_doc->createCDATASection($image_title);
// $title_element->appendChild($title_text);
// $image_element->appendChild($title_element);

The leading // comments out a line and it will just be ignored rather than parsed and executed.

(The descriptions will still be used as the image captions.)

Please note that the line numbers above refer to the current version of WP-Juicebox (v1.5.1.1).

thanks a lot!

Re: Need to hide ALT tags

@jasonsmith

I'm glad my suggestion helped you out.
Thank you for letting me know.

Re: Need to hide ALT tags

The latest version of WP-Juicebox (v1.5.1.2) now includes interface options to easily display or hide image titles and captions.

Just select (or deselect) the "Display Image Titles" and "Display Image Captions" checkboxes in the gallery settings window to display (or hide) the image titles and captions. (These new checkboxes are selected by default.)

WP-Juicebox can be downloaded from its own support page here.