For the benefit of anyone else that might have this problem:
The site map generated by SimplePress theme is populated using the wp_list_authors() function which can be found at /wp-includes/author-template.php and is therefore part of the WordPress codebase.
This issue with using this function is that the filter options are very limited - you can exclude all "admin" accounts for the list of post authors, but there is no facility to exclude a specific post author based on their user ID or display name.
The solution (which works with SimplePress) was to copy-and-paste the wp_list_authors() function and then find an appropriate script in the theme to put a renamed version of the function in, and then modify it to support the update. SimplePress has a "custom_functions.php" script specifically for this purpose, and the wp_list_authors() was modified as follows - just the first section of the function has been included as only two lines need to be modified in addition to the change of function name:
ORIGINAL CODE - wp_list_authors() function in /wp-includes/author-template.php
Code: Select all
function wp_list_authors($args = '') {
global $wpdb;
$defaults = array(
'orderby' => 'name', 'order' => 'ASC', 'number' => '',
'optioncount' => false, 'exclude_admin' => true,
'show_fullname' => false, 'hide_empty' => true,
'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true,
'style' => 'list', 'html' => true
);
$args = wp_parse_args( $args, $defaults );
extract( $args, EXTR_SKIP );
$return = '';
$query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number' ) );
$query_args['fields'] = 'ids';
$authors = get_users( $query_args );
$author_count = array();
foreach ( (array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author") as $row )
$author_count[$row->post_author] = $row->count;
REVISED CODE - custom_wp_list_authors() function in /wp-content/themes/SimplePress/epanel/custom_functions.php
Code: Select all
function custom_wp_list_authors($args = '') {
global $wpdb;
$defaults = array(
'orderby' => 'name', 'order' => 'ASC', 'number' => '',
'optioncount' => false, 'exclude_admin' => true,
'show_fullname' => false, 'hide_empty' => true,
'feed' => '', 'feed_image' => '', 'feed_type' => '', 'echo' => true,
'style' => 'list', 'html' => true
);
$args = wp_parse_args( $args, $defaults );
extract( $args, EXTR_SKIP );
$return = '';
$query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number' ) );
$query_args['fields'] = 'ids';
$authors = get_users( $query_args );
$author_count = array();
$excluded_author_id_list = '888'; // User ID to be excluded from results; use comma separated values if multiple users need to be excluded
foreach ( (array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " AND post_author NOT IN ($excluded_author_id_list) GROUP BY post_author") as $row )
$author_count[$row->post_author] = $row->count;
Note that it is also good practice to add the following code before/after your custom function to avoid function declaration problems:
Code: Select all
if ( ! function_exists( 'custom_wp_list_authors' ) ){
// function declaration goes here
}
The reference to this function is then updated in /wp-content/themes/SimplePress/page-sitemap.php by just changing the name of the existing function to the new one.
M_G