Forums

Repeated posts in list (lame question?) (2 posts)

  1. tanguillo
    Member
    Posted 2 years ago #

    They seems to be an error in how the popularity contest plugins show the list of post. In the root (or home page) of www.tangoscopio.com some posts appears many times in the list. The weird things is that the list appears correctly if the page es a single post.
    Why this could be happening? Any ideas? Thanks!

  2. tanguillo
    Member
    Posted 2 years ago #

    Ok, I discover what it is. I don't know exactly why, but in the query to show the list of most popular post, the join and a clause where of the the category query is add. To show you exactly what I mean:
    This is the correct query, as it was use in all the pages but the home:

    SELECT ID, post_title FROM wp_posts LEFT JOIN wp_ak_popularity pop ON wp_posts.ID = pop.post_id WHERE post_status = 'publish' AND post_date < NOW() ORDER BY pop.total DESC LIMIT 10

    And this is how was use it in the home page:

    SELECT ID, post_title FROM wp_posts LEFT JOIN wp_ak_popularity pop ON wp_posts.ID = pop.post_id LEFT JOIN wp_post2cat ON wp_post2cat.post_id = wp_posts.ID WHERE post_status = 'publish' AND post_date < NOW() AND wp_post2cat.category_id NOT IN (19) ORDER BY pop.total DESC LIMIT 10

    I dont know to reason of it. I was using just the function: akpc_most_popular()

    Anyway, I was able to resolved that commenting the lines 1357, 1358 and 1359:

    //		$join = apply_filters('posts_join', '');
    //		$where = apply_filters('posts_where', '');
    //		$groupby = apply_filters('posts_groupby', '');

    Probably not the best solution, but working so far. And I star to use the akpc_most_popular_in_cat and it work correctly to.

Topic Closed

This topic has been closed to new replies.

About this Topic