Custom author page in Wordpress prob

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rradvice
Forum Newbie
Posts: 1
Joined: Wed Jan 13, 2010 12:20 pm

Custom author page in Wordpress prob

Post by rradvice »

Goal
build an author page that sorts and displays post titles link by category for selected author.
I am almost there
currently printing each category heading with all posts titles by the selected author

Remaining problem - empty category heading are still displayed. was thinking that a more specific if statement at the have_post function

First Section Prints Author Bio at top

This may change as I test potential approaches but shows the problem for now.
http://www.rradvice.com/author/abby

Code: Select all

 
<?php
global $options;
foreach ($options as $value) {
    if (get_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; }
    else { $$value['id'] = get_option( $value['id'] ); }
    }
?>
<?php get_header() ?>
 
    <div id="container">
        <div id="content">
 
<?php the_post() ?>
 
            <?php //thematic_page_title() 
                  //We've commented out the Thematic Page title since that info will be displayed in our Author area
            ?>      
 
<?php /* if display author bio is selected */ if($thm_authorinfo == 'true' & !is_paged()) { ?>
            <div id="author-info" class="vcard">
                <h2 class="entry-title"><?php _e('Author Archives: ', 'thematic') ?><strong><?php echo $authordata->nickname; ?> 
</strong></h2> 
                <?php thematic_author_info_avatar(); ?>
                <div class="author-bio note">
                    <?php if ( !(''== $authordata->user_description) ) : echo apply_filters('archive_meta', $authordata->user_description); endif; ?>
                </div>              
                <div class="author-url"><a href="<?php the_author_url() ?>">Website</a></div>
            </div><!-- #author-info -->
<?php } ?>
<div class="entry-content"> 
<?php //thematic_author_loop() - we won't use the default thematic author loop
      //instead will list the post sorted by category       
            $categories = get_categories();
 
    foreach($categories as $category){
                $cat_id = $category->cat_ID;
                $cat_slug = $category->category_nicename;
                $cat_name = $category->cat_name;
 
 
                //The Query
                query_posts(array(
                    'category__in'=>    $cat_id,
                    'author' =>         $authordata->ID,
                    'posts_per_page'=>  100
                    ));
                    
 // moved if have posts echo h2 from here
   if(have_posts() ){ //NEED TO LIMIT THE FOLLOWING ECHO to curauth
                        echo '<h2>' . $cat_name . '</h2>';
                    }    
                echo '<ul>';
                //The Loop
                while ( have_posts() ) : the_post() ;?>
  
  <?php
foreach ( get_the_category() as $category ) { 
 
} 
?>              
    <?php  if ($category->cat_name != $cat_name) {
        continue;} // skip a record
?> 
 
<!-- Display the Title as a link to the Posts permalink. -->
<p><li> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
 
 
 
</li></p>
 
                <?php endwhile;
                echo '</ul>';
 
                //Reset Query
                wp_reset_query();
            }
 ?>
</div>  
        </div><!-- #content -->
    </div><!-- #container -->
 
 
 
Post Reply