WordPress.org

Ready to get started?Download WordPress

Forums

Customizing an author page (1 post)

  1. tiedemies
    Member
    Posted 2 years ago #

    Hi,

    I've been struggling with customizing an author page.

    How can I add the author information into the query so that the page displays only current authors' posts?

    Wouldn't 'author' => $wp_query->get_queried_object()->ID work? If so, where and how do I exactly put it?

    <?php 
    
    /*
    Template Name: Author Template
    */
    
    get_header();
    $data = get_post_meta( $post->ID, 'key', true );
    $category = $data[ 'portfolio-category' ];
    $categoryID = get_category_id($category);
    ?>
    
    <div id="thumbs" class="gradient">
    	<ul>
    		<?php $showPostsInCategory = new WP_Query(); $showPostsInCategory->query('cat='. $categoryID .'&showposts=1000');
    	if ($showPostsInCategory->have_posts()) : while ($showPostsInCategory->have_posts()) : $showPostsInCategory->the_post();?>
    		<li>
    	    	<a class="thumbLink" href="#"><?php the_post_thumbnail('fullsize', array('title' => ""));?></a>
    	    	<p class="thumbTitle"><?php the_title(); ?></p>
    	    	<a class="readMore" href="<?php the_permalink() ?>">Read more &rarr;</a>
    	    </li>
    		<?php endwhile; endif; ?>
    	</ul>
    </div>
    
    <?php get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic