• 24-02-2018, 13:59:58
    #1
    Arkadaşlar merhaba,

    Aşağıda verdiğim kodların çıktısı aşağıda ki resim gibidir:


    <div class="side-author">
    <?php
    // Get the authors from the database ordered by user nicename
    global $wpdb;
    $site_admin = ""; // enter Admin ID to exclude
    $query = "SELECT ID, user_nicename from $wpdb->users WHERE ID != '$site_admin' ORDER BY user_nicename";
    $author_ids = $wpdb->get_results($query);
     
    // Loop through each author
    foreach($author_ids as $author) :
    // Get user data
    $curauth = get_userdata($author->ID);
    // Get link to author page
    $user_link = get_author_posts_url($curauth->ID);
    ?>
    <ul>
    <?php $author_query = new WP_Query( 'author='.$curauth->ID.'&posts_per_page=-1&showposts=1' );
    while ( $author_query->have_posts() ) : $author_query->the_post(); ?>
    <div class="author-images"><?php echo get_avatar(get_the_author_meta('user_email'),'50'); ?></div>
    <li class="author-nick"><?php echo $curauth->nickname; ?></li>
    <li class="author-aciklama"><?php the_author_meta('description'); ?></li>
    <li class="author-yazi"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    <?php endwhile; wp_reset_postdata(); ?></li>
    </ul>
    <?php endforeach; ?>
    </div>
    Ben istiyorum ki 5 adet yazar bu şekilde listelensin.
    Ve yebi bir yazı ekleyen yazar sıralama da en üst tarafa güncellensin. Sıralama bu şekilde devam etsin.
    Şİmdi ki halinde yazarları ve en son yazılarını görebiliyoruz fakat yeni bir yazı eklendiğinde yazarın sırası değişmiyor nerede ise orada kalyıor.

    Yardımcı olabilir misiniz?
  • 24-02-2018, 16:00:03
    #2
    Birde böyle denermisin.
    $args = array(
       'author=' => $curauth->ID,
    	'orderby' => 'author',
    	'order'   => 'DESC',
       'posts_per_page' => -1,
    );
    $author_query= new WP_Query( $args );
  • 24-02-2018, 16:10:24
    #3
    ilgixcom adlı üyeden alıntı: mesajı görüntüle
    Birde böyle denermisin.
    $args = array(
       'author=' => $curauth->ID,
        'orderby' => 'author',
        'order'   => 'DESC',
       'posts_per_page' => -1,
    );
    $author_query= new WP_Query( $args );
    Hocam merhaba,

    eğer aşağıda ki kullanımım doğru ise maalesef sonuç değişmedi:

    <?php
    $args = array(
       'author=' => $curauth->ID,
       'orderby' => 'author',
       'order'   => 'DESC',
       'posts_per_page' => -1,
    );
    $author_query= new WP_Query( $args );
    // Get the authors from the database ordered by user nicename
    global $wpdb;
    $site_admin = ""; // enter Admin ID to exclude
    $query = "SELECT ID, user_nicename from $wpdb->users WHERE ID != '$site_admin' ORDER BY user_nicename";
    $author_ids = $wpdb->get_results($query);
     
    // Loop through each author
    foreach($author_ids as $author) :
    // Get user data
    $curauth = get_userdata($author->ID);
    // Get link to author page
    $user_link = get_author_posts_url($curauth->ID);
    ?>
    <ul id="sev">
    <?php $author_query = new WP_Query( 'author='.$curauth->ID.'&posts_per_page=-1&showposts=1' );
    while ( $author_query->have_posts() ) : $author_query->the_post(); ?>
    <div class="author-images"><?php echo get_avatar(get_the_author_meta('user_email'),'50'); ?></div>
    <li class="author-nick"><?php echo $curauth->nickname; ?></li>
    <li class="author-aciklama"><?php the_author_meta('description'); ?></li>
    <li class="author-yazi"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    <?php endwhile; wp_reset_postdata(); ?></li>
    </ul>
    <?php endforeach; ?>
  • 24-02-2018, 16:16:31
    #4
    Sen en iyisi yukarda böyle satır var onu değiştir bununla, kod çıkmadı buraya nedense,
    $query = "SELECT ID, user_nicename from $wpdb->users WHERE ID != '$site_admin' ORDER BY user_nicename DESC";
  • 24-02-2018, 16:35:19
    #5
    ilgixcom adlı üyeden alıntı: mesajı görüntüle
    Sen en iyisi yukarda böyle satır var onu değiştir bununla, kod çıkmadı buraya nedense,
    $query = "SELECT ID, user_nicename from $wpdb->users WHERE ID != '$site_admin' ORDER BY user_nicename DESC";
    Hocam bu yöntem ile istediğim gibi oldu çok teşekkür edeirm Allah razı olsun.