Support » Theme: GamePress » Theme GamePress – Adding author-info link to posts

  • Hi alex27
    At first I would like to thank you for your theme.
    I really like it and it is what I have installed at the moment.

    In my opinion I am missing the “POST BY AUTHOR” link for each post, and the Author page.
    This is why I have took the liberty to change the following in your files:
    Original content-single.php

    <h2><?php the_title(); ?></h2>
    		<div class="entry-meta">
    			<?php the_time('F j, Y') ?> |
    			Posted in <?php echo get_the_category_list( __( ', ', 'gamepress' ) ); ?> |
    			<?php comments_popup_link(__('No comments','gamepress'), __('1 comment','gamepress'), __('Comments: %','gamepress')); ?>
    		</div>

    My version content-single.php

    <h2><?php the_title(); ?></h2>
    		<div class="entry-meta">
    			<p><?php printf(__('%s | Posted by %s | Posted in %s'),
    			get_the_time(get_option('date_format')),
    			'<a href="'. get_author_posts_url(get_the_author_ID()) .'" title="'. sprintf(__("Posts by %s","fusion"),
    			esc_attr(get_the_author())).' ">'. get_the_author() .'</a>',get_the_category_list(', ')
    			); ?>
    			| <?php comments_popup_link(__('No comments','gamepress'), __('1 comment','gamepress'), __('Comments: %','gamepress')); ?></p>
    		</div>

    Original content.php

    <div class="entry-meta">
    							<?php
    								if ( get_post_type() == 'gamepress_reviews') :
    									echo ge

    My version of content.php

    <div class="entry-meta">
    							<?php
    								echo 'Posted by <a href="'. get_author_posts_url(get_the_author_ID()) .'" title="'. sprintf(__("Posts by %s","fusion"),
    			esc_attr(get_the_author())).' ">'. get_the_author() .'</a> | ';
    								if ( get_post_type() == 'gamepress_reviews') :
    									echo ge

    I have added as well an author.php page that is a copy of your archive.php, but with the following added:

    <!-- Author section -->
    <div class="author-info">
        <?php
        $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
        ?>
    
    	<div class="author-avatar">
    		<?php echo get_avatar( get_the_author_meta( 'user_email' ), $size = '60' ); ?>
    	</div><!-- .author-avatar -->
    
    	<div class="author-description">
    	    <h2>About: <?php echo $curauth->nickname; ?></h2>
    	    <dl>
    		<dt>Website</dt>
    		<dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
    		<dt>Profile</dt>
    		<dd><?php echo $curauth->user_description; ?></dd>
    	    </dl>
    	</div><!-- .author-description	-->
    </div><!-- .author-info -->
    
    <!-- End Author section -->

    You can have a look at the result in my blog http://www.agigante.it

    It is still missing the css for the Author, I will probably take a look at it in the following days, but if you have any comment or suggestion I would be more then welcome to hear them.

    I am sorry if my code is not really clean, but it is been years without writing a single line and I am possibly messing a bit with it.

    Thanks in advance

    http://wordpress.org/extend/themes/gamepress/

Viewing 8 replies - 1 through 8 (of 8 total)
  • I forgot to comment that I have added as well content-smallthumb.php and content-bigthumb.php the following:
    echo 'Posted by <a href="'. get_author_posts_url(get_the_author_ID()) .'" title="'. sprintf(__("Posts by %s","gamepress"), esc_attr(get_the_author())).' ">'. get_the_author() .'</a> | ';

    Thanks again

    Theme Author alex27

    (@alex27)

    Glad you made it work 🙂 I might add this kind of functionality in the future, although most of the time people ask how to get rid of it :), so it would have to be optional.

    I second this option!

    Thanks for the information. I’ve modded something similar.

    I added the following code to the pages listed below:

    content-bigthumb, content-single, content-smallthumb, reviews-archive, reviews-single, video-archive, video-single

    <?php echo __( ‘ By ‘, ‘gamepresss’), __( ‘‘. get_the_author() .’‘); ?> |

    I notice that the archive page does not show Game Reviews and Video Review and only the main post reviews. The only other thing i’m missing is a author’s page at the moment.

    I have also added an author.php page that is a copy from your archive.php, but am in the process of creating the author layout.

    What’s the best way to get Archives, Game Archives, Video Archives to show on author.php? Thanks.

    Theme Author alex27

    (@alex27)

    You need to create custom WP Query.

    Could you help provide the code for this? The main page shows 2 posts (1 in regular, 1 in game review). But the author page only shows the 1 in regular post.

    http://livesf.com/author/livesf

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Theme GamePress – Adding author-info link to posts’ is closed to new replies.