Support » Plugin: Simple Staff List » Limit issue

  • Resolved David

    (@dkomando)


    Didn’t see a way to change this in any of the documentation, so sorry if I missed something.

    The plugin appears to have a hard-coded limit when it comes to displaying results, which is set to 100.
    Inside:
    simple-staff-list > public > partials > simple-staff-list-shortcode-display.php

    Would be nice to have a shortcode attribute like “limit” to be able to go beyond the 100 limit attached to $args[‘posts_per_page’] using something like $atts[‘limit’].
    e.g.
    [simple-staff-list orderby=”title” group=”staff” limit=”400″]

    Would rather not do the ugly band-aid fix of altering the plugin directly.

    • This topic was modified 1 month ago by  David.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Brett Shumaker

    (@brettshumaker)

    Hi @dkomando

    The plugin appears to have a hard-coded limit when it comes to displaying results, which is set to 100

    That’s true, but there’s also a filter that allows you to alter everything except the post_type argument that goes to the WP_Query. You can change the posts_per_page argument with the following snippet:

    
    /**
     * Makes Simple Staff List return 400 staff members per page.
     *
     * @param $args array The arguments that will be passed into WP_Query.
     */
    function wporg_forum_sslp_query_args( $args ) {
        $args['posts_per_page'] = 400;
        return $args;
    }
    add_filter( 'sslp_query_args', 'wporg_forum_sslp_query_args' );
    

    I will say that the 100 staff member limit I originally imposed was to prevent sites with large numbers of staff members from bogging down when the shortcode is used. I’m saying this just to warn that querying large numbers of staff members may cause slow page load times.

    Hope that helps!

    David

    (@dkomando)

    @brettshumaker,
    Thanks for the append/overwrite snippet and I can totally appreciate the large query slowdown warning.

    Totally helps!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.