Ricard Torres
Forum Replies Created
-
Forum: Plugins
In reply to: [Thumbs Rating] Show button without number of votesThank you for your kind words ??
1. Why can’t you hide the button with CSS, I don’t get why you need the span.
You can select anything with a class selector:
.thumbs-rating-up { display: none; }
2. Yeah maybe I’m missing something but I thought it was possible. That’s why I added the function checks. It has been quite some years since I’ve done PHP development myself.
There shouldn’t be any critical updates now that we’ve taken out the jQuery dependency, unless the WordPress core changes dramatically how it handles the meta data (highly doubtful as they always aim for backwards compatibility).
If all this is too much and it was already working for you in your production site, why not revert back to a version of the plugin prior to 4?
I’m sorry if this isn’t what you wanted to hear.
Forum: Plugins
In reply to: [Thumbs Rating] Show button without number of votesForum: Plugins
In reply to: [Thumbs Rating] Vanilla JS version in roadmap?Thank you, Mike. Good catch.
The theme I was testing on already had jQuery so I didn’t see any undefined.
I removed that piece of jQuery as it was doing nothing. The class “voted” was already being added via PHP. This jQuery was redundant.
Please upgrade to 4.0.3 and let me know
Thanks!
Forum: Plugins
In reply to: [Thumbs Rating] Vanilla JS version in roadmap?Hello Mike,
I have released version 4.0.2 dropping the jQuery dependency.
Have a look, give it a try, and let me know!
Forum: Plugins
In reply to: [Thumbs Rating] Vanilla JS version in roadmap?Hey Mike,
You’re absolutely right. We should remove it but then we need to consider what browsers are we supporting.
If we’re using the fetch API https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API we either drop IE11 support or add something like Axios to make it more heavy https://github.com/axios/axios
I think we could take the decision to move it to fetch, those who need the jQuery version can still use 3.4.2 version of the plugin.
We can also use the new ES6 syntax, again we could drop support and not transpile anything.
Alright, I’ll start looking and update this thread once I have something to share.
Forum: Plugins
In reply to: [Thumbs Rating] Works with images displayed by the WPBakery Grid element?I’m afraid you’ll have to find another plugin that works with Media attachments.
Good luck.
Forum: Plugins
In reply to: [Thumbs Rating] Works with images displayed by the WPBakery Grid element?The plugin only works with posts or custom post types as the data is stores in post meta fields.
Cheers.
Forum: Plugins
In reply to: [Thumbs Rating] Recent Top Rated PostsAh, I see. Perhaps I went too fast.
Right, yes.. so you can use the order by date to list the posts with that order.
However, what the other user did is modify the code of the plugin itself to extend that date query.
The file is thumbs-rating.php inside the plugin folder.
You will need a little of PHP knowledge to do that. I haven’t done it myself but I imagine he extended the array of arguments to include (around line 371):
'date_query' => array( array( 'after' => '1 month ago', ) )
So it would only show the posts with that time frame.
More info on the WP_Query possible arguments: https://developer.www.ads-software.com/reference/classes/wp_query/
If you do end up modifying the plugin, I would suggest also bumping the version number to prevent any auto-update from overwriting it. The version can also be found in the thumbs-rating.php (top of the file)
Best of luck!
Forum: Plugins
In reply to: [Thumbs Rating] Recent Top Rated PostsHello Steve
The plugin does not store any information other than the number of positive and negative votes. Thus, you can’t list or filter by date.
Best regards.
Forum: Plugins
In reply to: [Thumbs Rating] Show button without number of votesAwesome, glad it worked out.
Forum: Plugins
In reply to: [Thumbs Rating] Show button without number of votesI’m afraid there not an easy thing to do. No config or way to do it easily in CSS.
I would recommend forking the plugin (or modifying the files directly).
The function you should look for is thumbs_rating_getlink you could edit it to not print the number.
You will need a bit of PHP knowledge though.
Forum: Plugins
In reply to: [Thumbs Rating] Use only Thumb UpYes!
You can add this to your theme’s style.css file:
.thumbs-rating-down { display: none !important; }
It should hide the vote down button.
Hope this helps!
Ricard
Forum: Plugins
In reply to: [Thumbs Rating] Displaying sum of votes on each postJames,
Yeah what you got there seems to be correct.
I just copied parts of the source dode and made the sum afterwards:
$thumbs_rating_up_count = get_post_meta(get_the_ID(), '_thumbs_rating_up', true) != '' ? get_post_meta(get_the_ID(), '_thumbs_rating_up', true) : '0'; $thumbs_rating_down_count = get_post_meta(get_the_ID(), '_thumbs_rating_down', true) != '' ? get_post_meta(get_the_ID(), '_thumbs_rating_down', true) : '0'; echo $thumbs_rating_down_count + $thumbs_rating_up_count;
Hope this helps.
Forum: Plugins
In reply to: [Thumbs Rating] Show Counter outside ButtonThanks!
Not with code provided by the plugin.
I guess you might be able to use JavasScript. Mutation Observer could be used for this:
https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
Hope this helps!
Forum: Plugins
In reply to: [Thumbs Rating] IP address of votingHi there,
The plugin does not have any IP tracking.
It uses the browser’s LocalStorage to store which posts you have voted.
If the user goes to a different browser or opens a new incognito window, they can vote again the same posts.
More info on how LocalStorage works: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
Hope this helps.
Ricard