You can now use HTML in your image descriptions!
As of v2.1 you can now use Encoded HTML within your galleries/blog posts to add html elements to the descriptions of your images in Social Gallery!
If you take a look at the following example you can see Encoded HTML attributes in action:
Notice how on the right hand side there’s a little image and some red text (click it if you need to see it bigger) – that’s encoded html output into the image’s data-desc attribute. This allows you to put custom HTML to show in place of the description part of Social Gallery!
This is a much requested feature and will work in all modern browsers (that support data-attributes + HTML5!)
Here’s how you can try it:
Using WordPress’s esc_attr( function (if you know how) or a website like htmlentities.net you will need to encode some HTML which you want to show in the description.
… notice how the latter box has no common characters like < or ” or ‘ –
Next, copying your custom encoded HTML, add it to your image links in your post/page like the following example shows (click example image to see it larger.)
… by replacing *ENCODED HTML HERE* in that example with your encoded HTML you can choose what description HTML is shown with the linked image.
This is a hugely valuable feature for those who want to extend Social Gallery with their own HTML.
- By including both a “title” attribute and a “data-desc” attribute Social Gallery will use “title” for the bottom “basebar” and “data-desc” for the description – “data-desc” does not have to be encoded HTML, it can also be a standard text description that you want to include, rather than showing it in the bottom bar as well as the description area.
- Including just a “title” attribute fills both the bottom “basebar” (if enabled) and the description area with the value in “title”
- Including just a “data-desc” attribute fills the description area with the value in “data-desc” (HTML encoded or not) and does not affect the “basebar”.