Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Post-Kicker, -Byline & -Footer (http://forum.bytesforall.com/forumdisplay.php?f=17)
-   -   [SOLVED] How to Add Author Description to Page generated by "%author-posts-link%" (http://forum.bytesforall.com/showthread.php?t=11740)

Steve41 Dec 15, 2010 03:45 AM

[SOLVED] How to Add Author Description to Page generated by "%author-posts-link%"
 
In my old theme, when you clicked on the Author's name in the byline, that took you to an "authors page" that had at the top the bio for the author and then a list of their posts. Not sure how I can do this with this theme. Any help appreciated.

The code in the old theme to grab the 'user_description' was:
PHP Code:

<?php
if(get_query_var('author_name')) :
    
$curauth get_user_by('slug'get_query_var('author_name'));
else :
    
$curauth get_userdata(get_query_var('author'));
endif;
?>

<h3>About<?php echo $curauth->nickname?></h3>
    <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>
  <h3>Posts by <?php echo $curauth->nickname?>:</h3>

    <ul>



        <?php if (have_posts()) : ?>

       <?php $post $posts[0]; // Hack. Set $post so that the_date() works. ?>
       <?php /* If this is a category archive */ if (is_category()) { ?>
        <h3 class="pagetitle">Archive for the <?php single_cat_title(); ?> Category</h3>
       <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
        <h3 class="pagetitle">Posts Tagged <?php single_tag_title(); ?></h3>
       <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
        <h3 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h3>
       <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
        <h3 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h3>
       <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
        <h3 class="pagetitle">Archive for <?php the_time('Y'); ?></h3>
      <?php /* If this is an author archive */ } elseif (is_author()) { ?>
        <h3 class="pagetitle">Author Archive</h3>
       <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
        <h3 class="pagetitle">Blog Archives</h3>
       <?php ?>

        <?php while (have_posts()) : the_post(); ?>

Appreciate any help on this please

juggledad Dec 15, 2010 05:20 AM

this will give you part of it. Add the following to the bottom of ATO->Style & edit CENTER COLUMN->Content ABOVE the LOOP
HTML Code:

<?php if (is_author()) { ?>
<h3>About: <?php the_author(); ?></h3>
    <dl>
        <dt>Website</dt>
        <dd> <?php the_author_link(); ?></dd>
        <dt>Profile</dt>
        <dd><?php the_author_meta('description'); ?></dd>
    </dl>
  <h3>Posts by <?php the_author(); ?>:</h3>

<?php }; ?>

this will not break it down by archive/category etc, but it will list the posts

Steve41 Dec 15, 2010 03:28 PM

Thanks for that, it didn't work as posted (didn't retrieve any data), but it gave me the idea how to fix it. Not elegant, but then I'm not a programmer :)
Solution:
PHP Code:

<?php
if(is_author()) {
if(
get_query_var('author_name')) :
    
$curauth get_user_by('slug'get_query_var('author_name'));
else :
    
$curauth get_userdata(get_query_var('author'));
endif;
echo 
'About:'.$curauth->nickname;
echo 
'<dl><dt>Website</dt><dd><a href="'.$curauth->user_url.'">'.$curauth->user_url.'</a></dd>';
echo 
'<dt>Profile</dt><dd>'.$curauth->user_description.'</dd></dl>';
 } 
 
?>


juggledad Dec 15, 2010 04:46 PM

odd, it works fine for me - might be a release issue, but if your version works great.


All times are GMT -6. The time now is 07:38 PM.

Powered by vBulletin® Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.