Home Forums WTI Like Post PRO Change Like this and Dislike this text for some categories Reply To: Change Like this and Dislike this text for some categories

#426
D
Participant

Figured it out, thanks for the push and the help Web Techies. I’m posting the solution for anyone that might want this functionality: in wti_like_post.php
locate:

$wti_user_likes .= ($users_count > 1 || ($users_count == 1 && $flag == true)) ? __('like this', 'wti-like-post') : __('likes this', 'wti-like-post');

copy this line of code giving you two lines of the same block of code, one to customize for your own text targeting specified categories and the other to leave the same for remaining categories. When you’re finished your code block should look like this, with targeting categories:


$my_cat_ids = array(PLACE CATEGORY NUMBERS HERE);
$category_ids = wp_get_post_categories( $post_id );
$match_array = array_intersect( $my_cat_ids, $category_ids );
if ( !empty( $match_array ) ) {

$wti_user_likes .= ($users_count > 1 || ($users_count == 1 && $flag == true)) ? __('MY CUSTOM TEXT', 'wti-like-post') : __('MY CUSTOM TEXT', 'wti-like-post');

}else{

$wti_user_likes .= ($users_count > 1 || ($users_count == 1 && $flag == true)) ? __('like this', 'wti-like-post') : __('likes this', 'wti-like-post');

} ADDED CLOSING BRACKET
 }
   }
  • This reply was modified 8 years, 7 months ago by D.