Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Junior Member
    Join Date
    Feb 2015
    Posts
    9

    List of dislike posts

    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


  2. #2
    LikeBtn Support support's Avatar
    Join Date
    Jan 2015
    Posts
    121
    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.


  3. #3
    Junior Member
    Join Date
    Feb 2015
    Posts
    9
    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 ?


  4. #4
    LikeBtn Support support's Avatar
    Join Date
    Jan 2015
    Posts
    121
    We will consider this.


  5. #5
    LikeBtn Support support's Avatar
    Join Date
    Jan 2015
    Posts
    121
    In the short code you have the "sort" parameter. Try to sort content by dislikes. This may help you.


  6. #6
    Junior Member
    Join Date
    Feb 2015
    Posts
    9
    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.


  7. #7

  8. #8
    Junior Member
    Join Date
    Feb 2015
    Posts
    9
    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 ?


  9. #9
    LikeBtn Support support's Avatar
    Join Date
    Jan 2015
    Posts
    121
    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;
    ?>


  10. #10
    Junior Member
    Join Date
    Feb 2015
    Posts
    9
    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 :/


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •