• 01-04-2019, 13:27:33
    #1
    Merhaba Wordpress yazarlar sayfası oluşutrdum ama tüm yazarları çekiyor istiyorum ki ID sini girdiğim yazarlar görünsün bunu nasıl yaparım.

    <?php
    /*
    	Template Name: Yazarlar
    */
    ?>
    <?php get_header(); ?>
    <div id="allAuthorsPage" class="box">
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    	<?php if(xoption('breadcrumb') == "evet") : ?>
    	<div id="breadcrumb">
    		<?php the_breadcrumb(); ?>
    	</div>	
    	<?php endif; ?>
    	<h1 class="mainHeading"><?php the_title(); ?></h1>
    	<div class="reading">
    		<?php the_content(); ?>
    	</div>
    	<?php endwhile; ?>
    
    	<div class="articleList article">
    
    		<?php $args = array(
    			'blog_id'      => $GLOBALS['blog_id'],
    			'role'         => 'author',
    			'meta_key'     => '',
    			'meta_value'   => '',
    			'meta_compare' => '',
    			'meta_query'   => array(),
    			'include'      => array(),
    			'exclude'      => array(),
    			'orderby'      => 'login',
    			'order'        => 'ASC',
    			'offset'       => '',
    			'search'       => '',
    			'number'       => '',
    			'count_total'  => false,
    			'fields'       => 'all',
    			'who'          => ''
    		);
    		$authors = get_users( $args );
    		foreach ($authors as $author) {
    			$image = get_avatar($author->ID, 200); 
    			$image = explode('src="', $image);
    			$image = explode('"', $image[1]);
    			$image = $image[0];
    			if(!$image) $image = get_user_meta($author->ID, 'avatar', true);
    			if(!$image)	$image = get_bloginfo('template_url') . '/images/noauthor.png';
    			?>
    			<div class="post-container">
    				<div class="post">
    					<div class="thumb">
    						<a href="<?php echo get_author_posts_url($author->ID) ?>">
    							<img src="<?php bloginfo("template_url") ?>/lib/timthumb.php?src=<?php echo $image ?>&amp;w=70&amp;h=70" width="70" height="70" alt="<?php echo $author->display_name ?>" />
    						</a>
    					</div>
    					<div class="info">
    						<p class="author-name"><a href="<?php echo get_author_posts_url($author->ID) ?>">
    							<?php echo $author->display_name; ?></a>
    						</p>
    						<?php
    						$query = new wp_query('posts_per_page=1&author='. $author->ID);
    						if( $query->have_posts() ) {
    							while ($query->have_posts()) {
    								$query->the_post();
    								?>
    								<p class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
    								<p class="date"><?php the_time('d F Y'); ?></p>
    							<?php
    							}
    						}
    						?>
    					</div>
    				</div>
    			</div>
    			<?php
    		}
    		?>
    	</div>
    
    </div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
  • 01-04-2019, 13:55:22
    #2
    'include'      => array(),
    array içerisine gösterilmesini istediğiniz yazarların id sini yazacaksınız. Örneğin:

    'include'      => array(1 ,5, 6)
  • 01-04-2019, 14:14:21
    #3
    bababilgisayar adlı üyeden alıntı: mesajı görüntüle
    Merhaba Wordpress yazarlar sayfası oluşutrdum ama tüm yazarları çekiyor istiyorum ki ID sini girdiğim yazarlar görünsün bunu nasıl yaparım.

    <?php
    /*
        Template Name: Yazarlar
    */
    ?>
    <?php get_header(); ?>
    <div id="allAuthorsPage" class="box">
        <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
        <?php if(xoption('breadcrumb') == "evet") : ?>
        <div id="breadcrumb">
            <?php the_breadcrumb(); ?>
        </div>    
        <?php endif; ?>
        <h1 class="mainHeading"><?php the_title(); ?></h1>
        <div class="reading">
            <?php the_content(); ?>
        </div>
        <?php endwhile; ?>
    
        <div class="articleList article">
    
            <?php $args = array(
                'blog_id'      => $GLOBALS['blog_id'],
                'role'         => 'author',
                'meta_key'     => '',
                'meta_value'   => '',
                'meta_compare' => '',
                'meta_query'   => array(),
                'include'      => array(),
                'exclude'      => array(),
                'orderby'      => 'login',
                'order'        => 'ASC',
                'offset'       => '',
                'search'       => '',
                'number'       => '',
                'count_total'  => false,
                'fields'       => 'all',
                'who'          => ''
            );
            $authors = get_users( $args );
            foreach ($authors as $author) {
                $image = get_avatar($author->ID, 200);
                $image = explode('src="', $image);
                $image = explode('"', $image[1]);
                $image = $image[0];
                if(!$image) $image = get_user_meta($author->ID, 'avatar', true);
                if(!$image)    $image = get_bloginfo('template_url') . '/images/noauthor.png';
                ?>
                <div class="post-container">
                    <div class="post">
                        <div class="thumb">
                            <a href="<?php echo get_author_posts_url($author->ID) ?>">
                                <img src="<?php bloginfo("template_url") ?>/lib/timthumb.php?src=<?php echo $image ?>&amp;w=70&amp;h=70" width="70" height="70" alt="<?php echo $author->display_name ?>" />
                            </a>
                        </div>
                        <div class="info">
                            <p class="author-name"><a href="<?php echo get_author_posts_url($author->ID) ?>">
                                <?php echo $author->display_name; ?></a>
                            </p>
                            <?php
                            $query = new wp_query('posts_per_page=1&author='. $author->ID);
                            if( $query->have_posts() ) {
                                while ($query->have_posts()) {
                                    $query->the_post();
                                    ?>
                                    <p class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
                                    <p class="date"><?php the_time('d F Y'); ?></p>
                                <?php
                                }
                            }
                            ?>
                        </div>
                    </div>
                </div>
                <?php
            }
            ?>
        </div>
    
    </div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    Hocam benimde yazar sayfasına ihtiyacım var bana da yollama şansınız var mı? Birde nasıl yapılıyor bilgi verme şansınız var mı acaba?
  • 03-04-2019, 13:04:07
    #4
    bilimokur adlı üyeden alıntı: mesajı görüntüle
    'include'      => array(),
    array içerisine gösterilmesini istediğiniz yazarların id sini yazacaksınız. Örneğin:

    'include'      => array(1 ,5, 6)
    Çok teşekkürler