This code enables your site visitors to like, love or favorite images in your WordPress galleries and also the single gallery image on your media attachment page.
The code also enables users to comment on each image in every gallery or on the entire gallery.
There’s 4 steps :
Step 1 – Install the Favorites plugin and configure the settings as seen in this image.
Step 2 – Copy & paste the PHP code from the functions.php file to your child themes functions file or custom functionality plugin.
Step 3 – Upload the attachment.php template file to your child theme folder.
Step 4 – Copy & paste the CSS to the end of your stylesheet and remember to clear caching.