Replace like and comment buttons in the lightbox

Hello,
I am having this issue :
I would like to replace the “like” and “comment” text buttons in rtmedia lightbox with some wordpress dashicons.

For example, I want to replace the “like” with <span class="dashicons dashicons-heart"></span>
(and the “don’t like” would be replaced with the same icon but another color).

I have been looking for these buttons in php and js files but I don’t find what to modify.
Here is what I would like to obtain :


Thanks a lot for your help !

Marine

Hello @marine,

We were already thinking to add a filter which allows replacing the text by an icon. You would be happy to know that we have released a new version of rtMedia V4.3.2 with this filter added.

Please, go through the documentation here for the sample code - https://rtmedia.io/docs/developers/hooks/rtmedia_like_label_text-rtmedia_like_undo_label_text/

I hope this helps you. Thank you.

Hello,

Thanks a lot for the icons instead of the text “I like it / I don’t like it” in the lightbox.

However, I have a problem with the code, it doesn’t work :

If I click on “I like this”, a red heart appear so it’s ok. BUT if I leave the lightbox and if I return on it, the red heart is replaced by the sentence “I don’t like it”. (No red heart anymore, but the sentence instead).

Also, if I click on “I don’t like this”, the empty heart never appears, it is the sentence “I like it” which always displays.

Thanks for your help

Hello @marine,

I tried to regenerate the issue you mentioned but it is working fine for me.

Could you once check by activating any default theme of WordPress and deactivating other plugins? It may help to avoid any possible conflicts.

Thanks

Hello @pranalipatel,

Yes I tried to desactivate the other plugins but I still have the problem. I tried to change the code, using only

 function rtmedia_custom_update_like_label_text( $label ){
     $label ='<img src="http://cdn.shopify.com/s/files/1/1052/8468/t/4/assets/heart_icon2-15.png" />';
     return $label;
 }
 add_filter('rtmedia_like_label_text','rtmedia_custom_update_like_label_text');


 function rtmedia_custom_update_unlike_label_text( $label ){
     $label = '<img src="https://cdn6.giltcdn.com/images/share/uploads/0000/0005/0526/505264777/icon.png" />';
     return $label;
 }
 add_filter('rtmedia_like_undo_label_text','rtmedia_custom_update_unlike_label_text');

The icons work well when I click on them ( I like/I don’t like icons), But when I like an image, if I close the lightbox and if I open it after, the red heart becomes an empty heart. (But below it is written that I like the photo which is ok)

If I remove this part of code to use the texts by default (I like it / I don’t like it), it works well…

Thanks, Marine