BuddyDev

Search

How to change activity favorite text to like

  • Participant
    Level: Guru
    Posts: 701
    Tosin on #22262

    Hello,

    Please how can I change the activity (favorite) to (like) I applied this code to entry.php in my child theme which worked successfully but I noticed that when I click the like button, the button text changes back to favorite.

     <?php if ( bp_activity_can_favorite() ) : ?>
    
                                    <?php $like_count = (int) bp_activity_get_meta( bp_get_activity_id(), 'favorite_count' ); ?>
    
    					<?php if ( !bp_get_activity_is_favorite() ) : ?>
    
    						<a href="<?php bp_activity_favorite_link(); ?>" class="button fav bp-secondary-action fa fa-heart-o" title="<?php esc_attr_e( 'Like', 'klein' ); ?>"><?php _e( ' Like', 'klein' ); ?>
                                                            
    							<?php if ( $like_count ) : ?>
    								<span class="likes-count"><?php echo $like_count; ?></span>
    							<?php endif; ?>
    						</a>
    
    					<?php else : ?>
    
    						<a href="<?php bp_activity_unfavorite_link(); ?>" class="button unfav bp-secondary-action fa fa-heart" title="<?php esc_attr_e( 'Unlike', 'klein' ); ?>"><?php _e( ' Unlike', 'klein' ); ?>
                                                            
    							<?php if ( $like_count ) : ?>
    								<span class="likes-count"><?php echo $like_count; ?></span>
    							<?php endif; ?>
    						</a>
    
    					<?php endif; ?>
    
    				<?php endif; ?> 

    Also the font awesome icon (fa fa-heart-o) does not change immediately to (fa fa-heart) when the like button is clicked. It only changes when the whole page is reloaded.

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 21801
    Brajesh Singh on #22265

    Hi Tosin,
    I will suggest translation. That is the simplest way to do it.

    Depending on whether you are using a custom theme with BuddyPress support or not, you may need to translate BuddyPress or your custom theme.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved