PDA

View Full Version : List of dislike posts



admin39
05-18-2015, 10:35 AM
Hi,

in the doc there is something about how to list the most liked content with a shortcode but I haven't been able to find the same thing for showing the most disliked content with a shortcode. Is there a way to do this ?

Thanks

support
05-18-2015, 09:16 PM
Hi,
Yes, you can show only most liked content. But if you use statistics and synchronisation, you can write your code for show most disliked content, from database.

admin39
05-19-2015, 10:00 AM
Basically you are telling me that I just have to dupplicate the one function that creates the shortcode for showing the most liked content. Isn't it worth an update of the plugin to add it for everyone ? :)

support
05-19-2015, 05:00 PM
We will consider this.

support
05-20-2015, 09:29 AM
In the short code you have the "sort" parameter. Try to sort content by dislikes. This may help you.

admin39
05-20-2015, 11:25 AM
I don't see any reference to the parameter "sort" in the documentation. How do you use it ?

I've tried just to add sort="dislikes" but it still only show most likes posts.

support
05-21-2015, 09:29 AM
http://likebtn.com/en/wordpress-like-button-plugin#sort_posts_by_likes

admin39
05-22-2015, 04:59 PM
It's quite unelegant to just put some url there without more explanations, for example about the fact that's not direclty related to the shortcode and the sort parameter of it.

Anyway, the simple WP query :


query_posts('post_type=figurine&meta_key=Dislikes&orderby=meta_value&order=DESC&posts_per_page=20');

doesn't show the most disliked posts (figurine CPT here) ordered by number of dislikes but ordered by difference between likes and dislikes. What would be the correct query to just get the same results as in the widget "Most liked content" order by Dislikes ?

support
05-25-2015, 10:24 AM
This is correct WP query:

<?php
$query_args = array(
'post_type' => 'post',
'orderby' => 'meta_value',
'order' => 'DESC',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'Disikes',
'compare' => 'NOT EXISTS'
),
array(
'key' => 'Disikes',
'compare' => 'EXISTS'
)
)
);
$loop = new WP_Query($query_args);
if ($loop->have_posts()):
while($loop->have_posts()):
$loop->the_post();
?>
<a href="<?php the_permalink(); ?>">
<div>
<h3><?php echo the_title();?></h3>
<p><?php echo the_content(); ?></p>
</div>
</a>
<?php
endwhile;
endif;
?>

admin39
05-27-2015, 04:42 PM
I guess the "Disikes" was an error ? I tried your query (with and without the error) but it still doesn't show the same results as in the Widgets, unfortunately :/

LikeBtn
06-05-2015, 04:25 PM
Add the following parameter to the shortcode to sort by dislikes:


order="dislikes"

admin39
06-08-2015, 01:43 PM
This parameter still doesn't show the same results as in the widget, for reasons I don't get.