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 https://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
- The topic ‘Theme GamePress – Adding author-info link to posts’ is closed to new replies.