Support » Themes and Templates » Author page(s) only showing for page_id

  • Hello.

    I’m using a modified twentyten with wordpress 3.0.1.

    I’m trying to show the author’s profile and links when the author’s name link is clicked in a post. It only works when I’m using the default permalinks, and even then I only get the last post.

    My permalink structure: /%year%/%monthnum%/%postname%/

    What I want is to show their profile and all links when their name is clicked. I don’t want a special page to be created for this purpose, like in this example.

    What I would like to get is something like this.

    This is how my author.php looks like:

    <?php
    get_header(); ?>
         <div id="container">
         <div id="content" role="main">
    <?php
    	if ( have_posts() )
    		the_post();
    ?>
          <h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyten' ), "<span class='vcard'><a title='" . esc_attr( get_the_author() ) . "' rel='me'>" . get_the_author() . "</a></span>" ); ?>
          </h1>
    <?php
          if ( get_the_author_meta( 'description' ) ) : ?>
    				<div id="entry-author-info">
    					<div id="author-avatar">
    						<?php echo get_avatar( get_the_author_meta( 'user_email', $author->post_author ), apply_filters( 'twentyten_author_bio_avatar_size', 60 ) ); ?>
    				</div>
    				<div id="author-description">
    					<h2><?php printf( __( 'About %s', 'twentyten' ), get_the_author() ); ?>
    					</h2>
    					<?php the_author_meta( 'description' ); ?>
    				</div>
    			</div>
    <?php endif; ?>
    <?php
    	rewind_posts();
    	get_template_part( 'loop', 'author' );
    ?>
    			</div>
    		</div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    And this is the part of the loop.php that (I think) matters:

    <?php ?>
    <?php /* Display navigation to next/previous pages when applicable */ ?>
    <?php if ( $wp_query->max_num_pages > 1 ) : ?>
    	<div id="nav-above" class="navigation">
    		<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
    	</div>
    <?php endif; ?>
    <?php /* If no posts to display, such as an empty archive page */ ?>
    <?php if ( ! have_posts() ) : ?>
    	<div id="post-0" class="post error404 not-found">
    		<h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
    		<div class="entry-content">
    			<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
    			<?php get_search_form(); ?>
    		</div>
    	</div>
    <?php endif; ?>
    <?php /* Start the Loop. */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    <?php /* Display all posts. */ ?>
    	<?php else : ?>
    		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    			<h2 class="entry-title"><a>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    			<div class="entry-meta">
    				<p><br />Published on <?php the_time('F jS, Y') ?>, by <?php printf( __( ' %s', 'twentyten' ), "<span class='vcard'><a title='" . esc_attr( get_the_author() ) . "' rel='me'>" . get_the_author() . "</a></span>" ); ?>.</p></p>
    		</div></p>
    	<?php if ( is_archive() || is_search() ) : // Excerpts for archives and search. ?>
    			<div class="entry-summary">
    				<?php the_excerpt(); ?>
    			</div>
    	<?php else : ?>
    			<div class="entry-content">
    				<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?>
    				<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    			</div>
    	<?php endif; ?>
    			<div class="entry-utility">
    				<?php if ( count( get_the_category() ) ) : ?>
    					<span class="cat-links">
    					<?php printf( __( '<span class="%1$s">Category: </span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
    					</span>
    					<span class="meta-sep">|</span>
    				<?php endif; ?>
    				<?php
    					$tags_list = get_the_tag_list( '', ', ' );
    					if ( $tags_list ):
    				?>
    					<span class="tag-links">
    						<?php printf( __( '<span class="%1$s">Post Tags:</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
    					</span>
    			</div>
    		</div>
    		<?php comments_template( '', true ); ?>
    	<?php endif; // The if statement that broke the loop into three parts based on categories. ?>
    <?php endwhile; // End the loop. ?>
    <?php /* Navigation to next/previous pages. */ ?>
    <?php if (  $wp_query->max_num_pages > 1 ) : ?>
    				<div id="nav-below" class="navigation">
    					<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div>
    					<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
    				</div>
    <?php endif; ?>

    I removed the comments-link and edit-post-link because I don’t want to offer that facility. I’m sorry for having to post all that code, but I couldn’t see a better way of explaining my issues.

    So, I would be grateful if anyone could help me out here.

    Regards,
    Bob

Viewing 5 replies - 1 through 5 (of 5 total)
  • I forgot the link to my site:

    http://www.pastorbob.co.uk

    You know what, forget about it. It seems that I will be not receiving any support, not when I need it at least.

    I’ll try to fix it myself somehow.

    Regards,
    Bob

    I have the same problem, and some of the advice I found in the forum was outright wrong!

    Hey guys! I’m using the same template, modified too. With TwentyTen on the site I’m working with, the author page is a little messed up (because I had to move <div class=”main”> out of the header and into the page template files. I didn’t want the header image on every dang page of the site. Anyway, I tried editing the Author.php file and it has no effect on the author page. Here is the page that is giving me trouble: http://www.bcogwc.org/author/admin/ I’ve even tried deleting the Author.php file completely and there is no effect whatsoever. Help?

    Battling with PhP myself, I managed to get a list of all posts by the selected author (in the footer of a post) – however, the loop messes up the structure of the page – working on that, but here is what works:

    1) – find/select current author

    <?php
    	global $wp_query;
    	$curauth = $wp_query->get_queried_object();
    ?>

    2) – Select pages of that author – leave the ‘only pages’ line out if you want posts (or change it into ‘post’). Put this before The Loop.

    <?php
             $args = array(
    	         'post_type' => 'page',              // Only Pages
    	         'author' => $curauth->ID
                     );
           query_posts($args);
      ?>

    3) This is The Loop – I only want links there (no dates etc.)

    <ul>
    <!-- The Loop -->
    
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <li>
                <a href="<?php the_permalink() ?>" rel="" title=" <?php the_title(); ?>"> <?php the_title(); ?></a>
            </li>
    
        <?php endwhile; else: ?>
            <p><?php _e('No posts by this author.'); ?></p>
    
        <?php endif; ?>
    
    <!-- End Loop -->
    
        </ul>

    It’s very basic, but it took me ages to get it to work for pages – and somehow, it now creates some extra sections for each page listed – destroying the layout – but at least the list is there…

    HTH

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Author page(s) only showing for page_id’ is closed to new replies.