Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Wordpress - Alle Autoren anzeigen (https://www.delphipraxis.net/91975-wordpress-alle-autoren-anzeigen.html)

Balu der Bär 12. Mai 2007 16:30


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:
         [*]<h2>Authors</h2>
            <ul>
            <?php wp_list_authors(); ?>
            [/list]
Das klappt aber nur teilweise, Ich werde nicht aufgelistet, nur der andere Autor. :?
Also fix mal nachgeguckt wo die Funktionen sind und was sie machen, bzw. habe schon zwei Änderungen vorgenommen:

Delphi-Quellcode:
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";
   }
}
Trotzdem werde ich nicht mit aufgelistet. Jemand ne Idee?

Balu der Bär 12. Mai 2007 16:43

Re: Wordpress - Alle Autoren anzeigen
 
Vergesst diesen Thread, ein
Code:
wp_list_authors("exclude_admin");
hat dann doch gereicht, danke Spinnchen. :wall: :duck:


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:14 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz