function wiziapp_buildPostsByAuthorPage($author_id) { $numberOfPosts = WiziappConfig::getInstance()->posts_list_limit; $screen_conf = $GLOBALS['WiziappScreens']->getScreenLayout('posts', 'author_list'); $cQuery = "orderby=modified&posts_per_page=-1&author={$author_id}"; $countQuery = new WP_Query($cQuery); $total = count($countQuery->posts); $pager = new WiziappPagination($total); $query = "orderby=modified&posts_per_page={$numberOfPosts}&author={$author_id}&offset={$pager->getOffset()}"; $authorInfo = get_userdata($author_id); $authorName = $authorInfo->display_name; $title = wiziapp_formatComponentText(__("Posts By:", 'wiziapp') . " {$authorName}"); wiziapp_buildPostListPage($query, $title, $screen_conf['items'], false, $pager->leftToShow); }
function wiziapp_getPostNavigation($post_id) { /** * Navigation template tags works inside templates, * but since we could really use the great work * wordpress team made there we should fake the * loop so we can reuse the code. It will require manually * settings the is_single attribute of the global wp_query * to true, so wordpress will think there is a point in showing * the navigation links... */ global $post, $wp_query; $wp_query->is_single = TRUE; $post = get_post($post_id); setup_postdata($post); $nav = array(); $navLinks = array(); // Get the prev/next posts links $prevPost = get_adjacent_post(FALSE, '', TRUE); if ($prevPost) { $navLinks[] = array("link" => array("text" => wiziapp_formatComponentText(str_replace('&', '&', $prevPost->post_title), __("Previous Post")), "image" => wiziapp_getPrevPostImage(), "link" => wiziapp_buildPostLink($prevPost->ID))); } $nextPost = get_adjacent_post(FALSE, '', FALSE); if ($nextPost) { $navLinks[] = array("link" => array("text" => wiziapp_formatComponentText(str_replace('&', '&', $nextPost->post_title), __("Next Post")), "image" => wiziapp_getNextPostImage(), "link" => wiziapp_buildPostLink($nextPost->ID))); } $nav = array("navigation" => array("links" => $navLinks)); return wiziapp_specialComponent("navigation", $nav); }