Last 5 posts by %A'); add_option('ddpa_show_date', TRUE); add_option('ddpa_date_format', 'F jS, Y'); add_option('ddpa_inc_current', FALSE); add_option('ddpa_newest_first', TRUE); add_option('ddpa_excluded_cats', ''); function ddpa_add_option_pages() { if (function_exists('add_options_page')) { add_options_page('Posts by Author', 'DDPostsByAuthor', 8, __FILE__, 'ddpa_options_page'); } } function ddpa_options_page() { if (isset($_POST['info_update'])) { ?>

Posts by Author v1.1

To check for new versions or get more information, visit this plugin's page.

">
Display
Show at the bottom of every post />

If you prefer, you can manually generate the list by
typing <!-- ddpostsbyauthor --> in a post.
Options
Number of posts to show by author
Text to show before list
( To show the author's name, use %A )
Category IDs to exclude from post lists
( separate IDs with a comma )
Show date after listed posts />
Date format
( Use the standard PHP date() format )
Include current post in list /> ( If it is one of the last X posts )
Show newest posts first /> ( Otherwise oldest posts will be shown first )
ID; $c_author_id = $post->post_author; $a_tmp = get_userdata($c_author_id); $c_author = $a_tmp->user_login; // fix up header $ddpa_header = str_replace('%A', $c_author, $ddpa_header); // see if we show current post if (!$ddpa_inc_current) { $ddpa_inc_current = " AND ID != " . $c_post . " "; } else { $ddpa_inc_current = " "; } // sorting $newest_check = ' ASC '; if ($ddpa_newest_first) { $newest_check = ' DESC '; } // get excluded cat list if (strlen(trim($ddpa_excluded_cats)) > 0) { $t_exclude = (array)explode(',', $ddpa_excluded_cats); } $exclude_check = ' '; for ($i = 0; $i < count($t_exclude); $i++) { $exclude_check .= ' AND category_id != ' . (int)$t_exclude[$i] . ' '; } $last_posts = (array)$wpdb->get_results(" SELECT ID, post_title, post_date, post_category FROM {$table_prefix}posts, {$table_prefix}post2cat WHERE post_author = {$c_author_id} {$exclude_check} AND {$table_prefix}posts.ID = {$table_prefix}post2cat.post_id {$ddpa_inc_current} AND post_status = 'publish' GROUP BY ID ORDER BY post_date {$newest_check} LIMIT {$ddpa_num} "); if (count($last_posts) > 0) { $the_output = NULL; $the_output .= $ddpa_header; $the_output .= ""; } return $the_output; } function ddpa_generate($content) { $content = str_replace("", ddpa_show_posts(), $content); if (is_single()) { if (get_option('ddpa_all_posts')) { return $content . ddpa_show_posts(); } else { return $content; } } else { return $content; } } add_filter('the_content', 'ddpa_generate'); add_action('admin_menu', 'ddpa_add_option_pages'); ?>