WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Popular Posts
Forcing the number of items? (3 posts)

  1. Jon W
    Member
    Posted 3 years ago #

    OK, it may be working, but I am not sure.

    I have created custom category pages (e.g. category-10.php) so that I can control what appears in the category indexes. I have added this code to display just the most popular items of this category (by excluding all other categories):

    <?php get_mostpopular("pages=0&range=weekly&limit=20&category=3&stats_comments=0&cats_to_exclude=10,57,7304,33,6682,82,2515,6684,7302,42"); ?>

    But it is only showing 6 items, even though I am requesting 20.

    Now, I guess this is either because:

    1. there are only 6 items for category 3 listed (I know category=3 does not work, but I left it there to make my life easier....) which means nothing else will show. I can test this in a second actually by clicking on some other articles.

    2. In the top 20 posts 6 are category=3 and this is why it is displaying just 6.

    Any ideas? Is there a way to force it to display the top 20 of a particular category?

  2. Jon W
    Member
    Posted 3 years ago #

    ah ha, it is no.1

    I now have 10 listed. Hmmm, why is nobody ready my articles? lol

  3. Jon W
    Member
    Posted 3 years ago #

    Ah, and 10 is the maximum that can be displayed? That is OK.

    Code now is:
    <?php get_mostpopular("pages=0&range=all&limit=10&category=3&stats_comments=0&cats_to_exclude=10,57,7304,33,6682,82,2515,6684,7302,42"); ?>
    Decided to change range to "all" to ensure that there are not empty lists at the start of the day.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic