Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

chachalady on "Native gallery shortcode output- title attribute"

$
0
0

Hello,
I would like to avoid installation of any other gallery plugin since Native wordpress gallery does everything I need (I even managed to add fancybox class and rel ...) EXCEPT ONE THING :
- there is no title attribute (and I need one in a> tag ... )

I know it is a "wordpress way" now : gallery shortcode generate the output without title , text we write inside image title is outputed in 'alt' like this:

<a class="fancybox" href="http://www.mydomain.com/..my-image.jpg" rel="galleryGroup">
<img class="attachment-thumbnail" width="150" height="150" alt="MY TITLE" src="http://www.mydomain.com/..my-image-thumb.jpg">
</a>

I need this:

<a class="fancybox" title="MY TITLE" href="http://www.mydomain.com/..my-image.jpg" rel="galleryGroup">
<img class="attachment-thumbnail" width="150" height="150" alt="MY TITLE" src="http://www.mydomain.com/..my-image-thumb.jpg">
</a>

Since the title is "picked up" in alt there must be the way to use it and write/ echo it in title attribute.

I really need it to work with gallery shortcode, when inserting gallery to post or page.
( title attr. while inserting single image is not so important right now ... it can be added manualy if needed ...)

If it means to hack the core wordpress file - so be it.!
I can live with that one and only hack - I will add it when updating wordpress ...

If there is other way please help - I was browsing through forums for days now with no luck ( either I messed up with code or syntax or the solution was not what I need ..)

I believe the code for gallery shortcode output is in wp-includes/media.php - don't know how to get the title from the image data and display it as title attribute in tag ...

Thanks,
ChachaLady


Viewing all articles
Browse latest Browse all 8245

Trending Articles