Sorting & Total Number of Posts

If you want to limit the total number of posts to display and apply sorting order then you could use some interesting parameters included to make this an easy task. These parameters are useful when combined with multiple categories and/or tags.

You can order posts from Newest to Oldest ‘newest‘ or Oldest to Newest ‘oldest‘, check the code below:

Shortcode:


[slposts sort_by_date=true sorting_order=oldest] // Display posts sorted by date from oldest to newest
[slposts sort_by_date=true sorting_limit=20] // Display the newest 20 posts found

// Advanced example
[slposts number_posts=50
         category=android,apple,microsoft
         sort_by_date=true
         sorting_limit=10
] // This will pull 50 posts from 3 categories, and display only 10
  // from newest to oldest

  • johnzena

    In your network latest posts there is a way to only include certain post numbers, but I see no example of this for the single latest posts pro version. What would the shortcode be? Thanks.

    • http://laelite.info/ L’Elite

      Hi John,

      In Network Latest Posts there is a parameter to include certain “Blogs” specifying their ID numbers, as well as a parameter to __Ignore__ posts. In Single Latest Posts there is no need to specify Blogs because there is only one, the parameter to __Ignore__ certain post IDs is: ignore_id which can be set to one or many post IDs comma separated.

      However, there is no way right now to pull only certain posts by ID. There is a workaround though, you could add a specific tag to each one of the posts you want to display, then set the tag parameter passing tag slugs comma separated. I will keep the “include_id” parameter in mind for future releases.

      If there is anything else I can help you with, please do not hesitate to ask.

  • http://www.cheekychickblog.com/ The Cheeky Chick

    Hi :-)

    Is there any way to crete a list of single posts – one from each category – using separate strings of shortcode? I’m trying to put a list of the latest post of each category on my home page. I tried using [slposts number_posts=1 category=being-silly sort_by_date=true sorting_limit=1] (making one for each category), but it didn’t work. Any advice would be tremendously helpful :-)

    • http://laelite.info/ L’Elite

      Hello, I see you figured it out. In case anyone else want to know:

      [slposts number_posts=1 category=mycat-1 sort_by_date=true]
      [slposts number_posts=1 category=mycat-2 sort_by_date=true]
      [slposts number_posts=1 category=mycat-3 sort_by_date=true]

      In case you’re using a custom stylesheet, then you just include it once:

      [slposts number_posts=1 category=mycat-1 sort_by_date=true css_style=mycustomstyle]
      [slposts number_posts=1 category=mycat-2 sort_by_date=true]
      [slposts number_posts=1 category=mycat-3 sort_by_date=true]

      Cheers.

  • http://www.cheekychickblog.com/ The Cheeky Chick

    I figured it out :-)

  • johnzena

    On the following page http://orlando-montenegro-cruz.wondervegas.com/art-gallery/ I’m using the following parameters: [slposts ignore_id=230 custom_post_type=page thumbnail=true] but the page with id=230 keeps showing up anyway. Is this because its installed on a subdomain in a multisite install?

    • http://laelite.info/ L’Elite

      Hi, could you please tell me which version of Single Latest Posts are you using? I’ve just tested your shortcode in one of my sites in a multisite install and works as expected. FYI Single Latest Posts current version is 1.7.1.

      Best regards,
      José SAYAGO.

      • johnzena

        Version 1.0.1 actually

        • http://laelite.info/ L’Elite

          Hello John, I just sent you the latest version along with your license code to your email address. Please install it and try again. Let me know if it solves your issue.

          • johnzena

            It works now. Thanks

          • http://laelite.info/ L’Elite

            Hi John, thank you for your feedback. I’m glad everything works as expected now.

          • johnzena

            One more thing, is there a way you can sort by alphabet? That is in alphabetical order. I don’t see any shortcut code in the readme.txt file.

          • http://laelite.info/ L’Elite

            Hello John, there are currently two sorting options: by category and date. I will keep this in mind for future improvements.

          • johnzena

            Okay thanks

  • johnzena

    I’m using version 1.0