pagination problem in author list page
-
I’ve made an author list page template using the author boxes of starbox plugin. It works well displaying all authors in the right order but it shows even authors with posts that are drafted and not yet published. I need to exclude the authors with post status ‘draft” but nothing seems to be working for me. Also I would like to create pagination displaying only 10 author boxes per page. I will appreciate any help.
add_action('init','starBoxCustom'); function starBoxCustom(){ if (!class_exists('ABH_Controllers_Frontend')) return; ABH_Classes_ObjController::getController('ABH_Controllers_Frontend')->custom = true; } function starBoxShow($user_id) { if (!class_exists('ABH_Controllers_Frontend')) return; ABH_Classes_ObjController::getController('ABH_Classes_Tools'); $theme = ABH_Classes_Tools::getOption('abh_theme'); $str = ''; $str .= '<script type="text/javascript" src="' . _ABH_ALL_THEMES_URL_ . $theme . '/js/frontend.js?ver=' . ABH_VERSION . '"></script>'; $str .= '<link rel="stylesheet" href="' . _ABH_ALL_THEMES_URL_ . $theme . '/css/frontend.css?ver=' . ABH_VERSION . '" type="text/css" media="all" />'; $str .= ABH_Classes_ObjController::getController('ABH_Controllers_Frontend')->showBox($user_id); return $str; } function contributors() { $authors = array(); // roles you want to include $roles = array('editor','author','contributor'); foreach ($roles as $role) { $users_query = get_users( array( 'fields' => array('ID', 'user_nicename'), 'orderby' => 'post_count', 'order' => 'DESC', 'role' => $role ) ); if($users_query) { $authors = array_merge($authors, $users_query); } } if(!empty($authors)) { foreach($authors as $author) { echo starBoxShow( $author->ID ); echo "<br />"; } } }
and I’m calling the function in the page template with this:
<div id="authorlist"><ul><?php contributors(); ?></ul></div>
- The topic ‘pagination problem in author list page’ is closed to new replies.