• Resolved jtcheng

    (@jtcheng)


    Is it possible to limit the number of users displayed in total using this shortcode?

    I currently have:
    [userlist role=”contributor” post_type=”userwaterfallreview” orderby=”post_count” order=”DESC” number=”10″]

    but it appears that the ‘number’ attribute only limits users per pagination.

    I’m looking to see if it’s possible to limit the number of users displayed outright.

    Note: I also tried to count by custom post type, but I don’t think this shortcode recognizes that and ignored that attribute. I’ve asked about that in a separate question.

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

Viewing 1 replies (of 1 total)
  • Plugin Author HelgaTheViking

    (@helgatheviking)

    Hi @jtcheng,

    I was going to suggest that you unhook the navigation and search templates if you don’t want to display them, but it appears that you can also force a limit by defining the “paged” variable to always be 1.

    [userlist number="5" paged="1"]

    For reference, the other way would be like this:

    
    function kia_remove_sul_nav( $query_id ) {
        if( $query_id == 'no_sul_nav' ) {
            remove_action( 'simple_user_listing_before_loop', array( Simple_User_Listing::get_instance(), 'add_search' ) );
            remove_action( 'simple_user_listing_after_loop', array( Simple_User_Listing::get_instance(), 'add_nav' ) );
        }
    }
    add_action( 'simple_user_listing_before_loop', 'kia_remove_sul_nav', 0 );
    

    But anyone who manually entered the pagination in the URL yoursite.com/directory/2 would be able to navigate to page 2. The “paged” argument looks like the best approach.

Viewing 1 replies (of 1 total)
  • The topic ‘Limit total number of users to display’ is closed to new replies.