Title: Adding a custom data-attribute to images
Last modified: May 17, 2020

---

# Adding a custom data-attribute to images

 *  Resolved [jasujs](https://wordpress.org/support/users/jasujs/)
 * (@jasujs)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/adding-a-custom-data-attribute-to-images/)
 * Hi there,
 * I’m trying to add an option to portfolio images.
    Under the Description / Categories/
   Format / Url, I’d like to add a custom option where the admin can put a text 
   inside of it (so I can retrieve it via JS)
 * I was looking into Hooks documentation but I didn’t find anything helpful. (Tried
   to check here but it was too complex for me [GitHub – VP](https://github.com/nk-o/visual-portfolio/blob/master/src/classes/class-extend.php))
   
   I tried to work with the ‘vpf_extend_portfolio_data_attributes’ but I didn’t 
   succeed to use it
 * Would you have any idea on how to do it ?
 * Have a good day !
    -  This topic was modified 6 years, 1 month ago by [jasujs](https://wordpress.org/support/users/jasujs/).

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

 *  Thread Starter [jasujs](https://wordpress.org/support/users/jasujs/)
 * (@jasujs)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/adding-a-custom-data-attribute-to-images/#post-12846512)
 * I’m doing this to be able to replace image on hover, as an overlay in a way. 
   If you know another workaround maybe…
    -  This reply was modified 6 years, 1 month ago by [jasujs](https://wordpress.org/support/users/jasujs/).
 *  Thread Starter [jasujs](https://wordpress.org/support/users/jasujs/)
 * (@jasujs)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/adding-a-custom-data-attribute-to-images/#post-12849422)
 * Well, I did it otherwise.
 * I create a category, that I will hide on front-end, then select it via jQuery
   in the img-wrap data-attribute and then do my thing with images I wanted to have
   a custom attribute 😉
 * Thank you anyway.
 * And wonderful plugin btw !
 *  Thread Starter [jasujs](https://wordpress.org/support/users/jasujs/)
 * (@jasujs)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/adding-a-custom-data-attribute-to-images/#post-12849425)
 * Close

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

The topic ‘Adding a custom data-attribute to images’ is closed to new replies.

 * ![](https://ps.w.org/visual-portfolio/assets/icon-256x256.png?rev=2389881)
 * [Visual Portfolio, Photo Gallery & Post Grid](https://wordpress.org/plugins/visual-portfolio/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/visual-portfolio/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/visual-portfolio/)
 * [Active Topics](https://wordpress.org/support/plugin/visual-portfolio/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/visual-portfolio/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/visual-portfolio/reviews/)

 * 3 replies
 * 1 participant
 * Last reply from: [jasujs](https://wordpress.org/support/users/jasujs/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/adding-a-custom-data-attribute-to-images/#post-12849425)
 * Status: resolved