![]() |
Wordpress - Alle Autoren anzeigen
Moin,
ich würde gerne in meinem Blog in der Sidebar alle Autoren auflisten, zur Zeit ist das ein weiterer User und Ich. Ich bin Administrator des Blogs. Ich habe folgenden Code eingebunden um alle Autoren aufzulisten:
Code:
Das klappt aber nur teilweise, Ich werde nicht aufgelistet, nur der andere Autor. :?
[*]<h2>Authors</h2>
<ul> <?php wp_list_authors(); ?> [/list] Also fix mal nachgeguckt wo die Funktionen sind und was sie machen, bzw. habe schon zwei Änderungen vorgenommen:
Delphi-Quellcode:
Trotzdem werde ich nicht mit aufgelistet. Jemand ne Idee?
function wp_list_authors($args = '') {
parse_str($args, $r); if ( !isset($r['optioncount']) ) $r['optioncount'] = false; if ( !isset($r['exclude_admin']) ) $r['exclude_admin'] = false; // war true, hab ich geändert if ( !isset($r['show_fullname']) ) $r['show_fullname'] = false; if ( !isset($r['hide_empty']) ) $r['hide_empty'] = true; if ( !isset($r['feed']) ) $r['feed'] = ''; if ( !isset($r['feed_image']) ) $r['feed_image'] = ''; list_authors($r['optioncount'], $r['exclude_admin'], $r['show_fullname'], $r['hide_empty'], $r['feed'], $r['feed_image']); } // $exclude_admin war true, hab ich geändert function list_authors($optioncount = false, $exclude_admin = false, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { global $wpdb; $query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name"; $authors = $wpdb->get_results($query); foreach ( (array) $authors as $author ) { $author = get_userdata( $author->ID ); $posts = get_usernumposts($author->ID); $name = $author->nickname; if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') ) $name = "$author->first_name $author->last_name"; if ( !($posts == 0 && $hide_empty) ) echo "[*]"; if ( $posts == 0 ) { if ( !$hide_empty ) $link = $name; } else { $link = '[url="' . get_author_link(0, $author->ID, $author->user_nicename) . '"]display_name)) . '">' . $name . '[/url]'; if ( (! empty($feed_image)) || (! empty($feed)) ) { $link .= ' '; if (empty($feed_image)) $link .= '('; $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"'; if ( !empty($feed) ) { $title = ' title="' . $feed . '"'; $alt = ' alt="' . $feed . '"'; $name = $feed; $link .= $title; } $link .= '>'; if ( !empty($feed_image) ) $link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />'; else $link .= $name; $link .= '</a>'; if ( empty($feed_image) ) $link .= ')'; } if ( $optioncount ) $link .= ' ('. $posts . ')'; } if ( !($posts == 0 && $hide_empty) ) echo "$link"; } } |
Re: Wordpress - Alle Autoren anzeigen
Vergesst diesen Thread, ein
Code:
hat dann doch gereicht, danke Spinnchen. :wall: :duck:
wp_list_authors("exclude_admin");
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:46 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz