Support » Plugin: Display Posts - Easy lists, grids, navigation, and more » 3.0 Update only shows 12 posts

  • Just updated and the posts_per_page parameter is no longer working. Example shortcodes in use:

    Posts
    [display-posts posts_per_page=”200″]

    Products
    [display-posts post_type=”product” posts_per_page=”200″ orderby=”title” order=”ASC” has_password=”false”]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    Have you made any code customizations using filters on your site. If so, please share your customizations.

    The posts_per_page parameter is working correctly for me. For instance, this Tutorials page has [display-posts posts_per_page="-1"] and is properly listing all tutorials.

    Normally I would recommend using the Health Check plugin to test Display Posts without other plugins, but it’s unlikely a plugin conflict if the only thing that’s changed is you updated the version.

    Just swapped back to 2.9.0 and the correct amount of posts show again. Interestingly it’s not showing the 10 default posts per the plugin, but it’s showing 12 posts per the theme (Salient).

    I’ll keep looking into it, but keep 2.9.0 for now. Thanks.

    Plugin Author Bill Erickson

    (@billerickson)

    That’s really strange. Version 3.0 did not include any modifications to the posts_per_page parameter (here’s a complete diff between the two versions).

    Since you mention it showed 12 posts as set in your theme rather than 10 as set in WordPress, my guess is your theme is affecting the query. I’m not sure why it wouldn’t have affected 2.9 though.

    Maybe you modified the plugin directly at one point to override code added by your theme and with the update that direct modification has been lost.

    I’m marking as resolved since this seems to be a theme-related issue and does not affect others using Display Posts.

    Super strange. I just added the few new lines of code regarding has_password to 2.9.0 and it works correctly.

    Could it be something to do with the new use of commas, or sanitizing different types of quote marks?

    Plugin Author Bill Erickson

    (@billerickson)

    It could be the quotes. Can you try re-typing the shortcode in the “Text” tab (if using Classic editor) to ensure you aren’t getting fancy quotes?

    If you’d like to debug further, try adding this to your theme’s functions.php file: https://gist.github.com/billerickson/90266f466967680609176c21da2f87cf

    That will print out (only for a logged in user) all the $args being passed to WP_Query.

    Just tested on staging, it works fine on the 2019 theme, so it’s an issue with the Salient theme.

    So what changed in 3.0 that worked in 2.9.0? I realize it’s a theme conflict, but it’s a particular conflict with something that changed in the latest update.

    Adding your function shows this:

    Array ( [cat] => 0 [category_name] => [order] => asc [orderby] => title [perm] => readable [post_type] => Array ( [0] => product ) [posts_per_page] => 200 [s] => [tag] => [has_password] => [post_status] => Array ( [0] => publish ) )

    Plugin Author Bill Erickson

    (@billerickson)

    Could you email me a copy of the Salient theme? It’ll be faster for me to troubleshoot directly rather than over the support forum like this.

    My email is bill.erickson@gmail.com

    Plugin Author Bill Erickson

    (@billerickson)

    Thanks for sending that over. I found the issue and documented it here: https://github.com/billerickson/display-posts-shortcode/issues/207

    This is resolved in 3.0.1 which I’ll release tomorrow.

    Hello Bill,

    It seems like I have the same issue. Here’s my code:
    [display-posts posts_per_page=”-1″ wrapper="div" wrapper_class="display-posts-listing grid" category="Cat1" image_size="thumbnail" include_date="true" date_format="F Y" orderby="date"]

    It just displays 10 posts.

    I’ve tried it with posts_per_page=”200″as well.
    3.0.1 is installed.
    I don’t think it’s a conflict with another Plugin.
    I use the coral dark theme.
    Any idea what to do?
    Thanks!

    Edit: When I had a read through my post again, I saw the mistake. The quote mark is a different one. Ignore me. It works now! 😀 Thanks and keep up the great work!

    • This reply was modified 1 year, 1 month ago by xentrax.
    • This reply was modified 1 year, 1 month ago by xentrax.
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘3.0 Update only shows 12 posts’ is closed to new replies.