Home › Forums › WTI Like Post PRO › Custom Button Integration and Like Avatars Placement
Tagged: avatar placement, button link, custom button, user avatar
- This topic has 7 replies, 2 voices, and was last updated 7 years, 11 months ago by ILLUMINICE.
-
AuthorPosts
-
November 1, 2016 at 1:18 am #458ILLUMINICEParticipant
Hello,
I’m doing a completely custom integration of WTI Like Post Pro in my template files. I’m facing two challenges at the moment and could use some advice.
1. I’ve setup a custom like button using an icon font with the following code:
<i class=“dashicons dashicons-thumbs-up”></i>
What I now need to do is apply the like link to this icon, but I am unsure of the best method. The GetWtiLikePost(); calls in it’s own link structure. I figured there had to be a more straight forward method of linking my icon, but php is not my specialty.
2. I want to display the user avatars of people who liked the posts, but I need to call in this function to a completely unique location. The problem right now is that the default way of displaying those avatars is just a nested div that displays next to the like button and totals. I want to call in this function separately so it’s more easy to place on the page. This way I don’t need to relocate the avatars with css to such a big degree. So the question is, is there some code I can use in my template to call in the avatars by themselves?
3. This is really more of a recommendation than a question, but it applies to the user avatars feature. On a large website with lots of likes there would be huge numbers of avatars displaying. It would be best if the plugin had an option of how many user avatars to display on the post page. There should also be an option for the avatar order, such as loading them randomly, or newest likes first, etc. These two features together would make the avatar feature much more practical.
Thanks ahead of time for your help!
~ Michael
- This topic was modified 7 years, 11 months ago by ILLUMINICE.
- This topic was modified 7 years, 11 months ago by ILLUMINICE.
- This topic was modified 7 years, 11 months ago by ILLUMINICE.
November 1, 2016 at 2:44 am #462WebtechideasKeymasterHi,
Please find our input below.1. Custom icons: We use anchor tag with all the attributes related to like/unlike activities. Within anchor tag, we use thumb image followed by a span to show the count. So you will have to use the following attributes for post id 7.
class="jlk"
data-task="like"
data-post_id="7"
=> dynamic post id
data-nonce="1574511354"
=> dynamic wp nonceThe span will be like this
<span class="lc-7 lc">0</span>
. Here like, lc refer to like thumb. For unlike thumb, they will be unlike, unlc respectively.2. The function used to get the users list is
GetWtiUserLikes
. So you can refer to this and implement according to your need.3. We are already in the process of implementing the number of users setting to show. We are currently showing the latest users first. We will add the random users functionality.
Thanks
November 1, 2016 at 5:20 pm #463ILLUMINICEParticipantHello,
Thanks for the quick response!
1. I’m wondering if perhaps you misunderstood what I am doing, because this does not pertain to a specific post. I have used the GetWtiLikePost(); function in my single post template to manually place the like functionality. I have hidden the default images (from your plugin) and also have disabled the native css. So the only thing displaying right now from the plugin is the like count, which is also clickable to like the post.
I have placed my own custom icon (using an icon-font) to the left of the like count. What I want to do is make that icon clickable to like the post, just like clicking on the count would do. This way the user can click either the icon or the count to like the post (just like they can do with your default images). But this isn’t for a specific post. It’s for the post of the page the user is looking at. Remember, I’m working in my single post template which applies to all posts.
2. Thank you for letting me know that function. I’ll try placing that today to see if it works as expected. If I have any issues I’ll let you know.
3. That is great news and thank you for taking my suggestion! Yes, I think it’s a good idea to have a setting that controls the loading order, especially when someone is limiting the number of avatars. If for example it is set to only display 10 avatars, it may be advantageous to have it load randomly each time. I’d give the choices of random load, latest likes first, or oldest likes first.
~ Michael
November 1, 2016 at 7:56 pm #464ILLUMINICEParticipantHello,
Please read my post above first…
Regarding #1, I’ve been trying to get this to work on my own using the following code:
<a class="lbg-style-1 like-<?php the_ID(); ?> jlk" data-task="like" data-post_id="<?php the_ID(); ?>" data-nonce="<?php echo $data_nonce; ?>" rel="nofollow"><i class="lc-<?php the_ID(); ?> lc erudites-icon dashicons dashicons-thumbs-up"></i></a>
Unfortunately the problem here is the $data_nonce. No matter what I do this variable will not work, and just leaves the nonce blank. I’ve also found that with the above code if I click on my custom icon it will print a new like count on the screen (which displays right next to the native count as a duplicate). Obviously I just want clicking on the icon to increase the native count used by the plugin, and not to create another count on the screen.
I’ve checked the rest of the variables and they are all working. But at this point I am stuck.
~ Michael
November 1, 2016 at 8:37 pm #465ILLUMINICEParticipantHello Again,
Sorry for yet another consecutive post (we’re obviously in different time-zones)… Please read my posts above first.
Regarding #2
I’ve been trying to get the avatars to appear on the post pages without success. This is the code I’m using in my single post template:
<div class="wti-user-likes wti-likes-<?php the_ID(); ?>"> <?php GetWtiUserLikes(); ?> </div>
When the page loads there is simply nothing inside of the div with this code. I’m obviously doing something wrong. I also had a thought, that I’d like each avatar to be linked to the respective author page. This is really something that the plugin should do by default (perhaps with an option).
~ Michael
November 2, 2016 at 4:49 pm #466ILLUMINICEParticipantI was hoping to have received a response from you today so I can complete this project. I’d greatly appreciate your help asap…
~ Michael
November 2, 2016 at 5:19 pm #467WebtechideasKeymasterCan you please share your site url so that we can have a look at the issue? Also send your files (complete theme) so that we can install and check your code.
November 2, 2016 at 7:00 pm #468ILLUMINICEParticipantI just sent you a response via email. I need to reply via email at this point for privacy concerns.
~ Michael
-
AuthorPosts
- The forum ‘WTI Like Post PRO’ is closed to new topics and replies.