ThemeShaper Forums » Thematic

[closed]

Thematic Author Box

(5 posts)
  • Started 1 year ago by bogh
  • Latest reply from bogh
  • This topic is not a support question
  1. bogh
    Member

    For those who need and Author box for their Thematic Child Theme, here is the code:

    Add this to functions.php:

    //Thematic Author Box
    function authorBox_above_comments() {
    ?>
    <div class="authorbox">
      <div class="left">
          <?php echo  get_avatar( get_the_author_meta('email'), '80' ); ?>
      </div>
    
      <div  class="right">
          <div class="author_box_author"><?php _e('by', 'thematic') ?> <?php  the_author_posts_link(); ?></div>
          <?php if ( get_the_author_meta('description') !='') { ?>
            <div class="author_box_description"><?php the_author_meta('description'); ?></div>
          <?php } ?>
          <div class="author_box_meta">
          <?php if ( get_the_author_meta('aim') !='') { ?>
            <div><a href="https://twitter.com/<?php the_author_meta('aim'); ?>" target="_blank">@<?php the_author_meta('aim'); ?></a></div>
          <?php } ?>
          <?php if ( get_the_author_meta('yim') !='') { ?>
            <div><span>Y!M: <?php the_author_meta('yim'); ?></span></div>
          <?php } ?>
          <?php if ( get_the_author_meta('url') !='http://') { ?>
            <div><?php _e('Website', 'thematic') ?>: <a href="<?php the_author_meta('url'); ?>" target="_blank"><?php the_author_meta('url'); ?></a></div>
          <?php } ?>
          </div>
      </div>
    </div>
    <?php }
    add_action('thematic_abovecomments','authorBox_above_comments',0);

    Add this to style.css:

    /* Author Informations Box */
    .authorbox {
    	overflow: hidden;
    	font-size: 13px;
    	background: #F5F5F5;
    	border: 1px solid #CCC;
    	color: #777;
    	text-shadow: 1px 1px 0px #FFF;
    	-webkit-border-radius: 5px;
    	-moz-border-radius: 5px;
    	border-radius: 5px;
    }
    .authorbox a {
    	color: #777;
    	text-decoration: none;
    }
    .authorbox .left {
    	float: left;
    	width: 90px;
    	height: 90px;
    	margin: 25px;
    }
    .authorbox .left img {
    	padding: 3px;
    	background: #FFF;
    	border: 1px solid #CCC;
    	border-bottom: 2px solid #BBB;
    	-webkit-border-radius: 5px;
    	-moz-border-radius: 5px;
    	border-radius: 5px;
    }
    .authorbox .right {
    	float: left;
    	margin-top: 25px;
    	width: 425px;
    }
    .authorbox .author_box_author {
    	font-weight: bold;
    	font-size: 16px;
    	color: #AAA;
    }
    .authorbox .author_box_author a {
    	color: #777;
    	text-decoration: none;
    }
    .authorbox .author_box_meta > div {
    	float: left;
    	margin: 0px 10px 10px 0px;
    	color: #555;
    }
    .authorbox .author_box_meta > div a {
    	color: #555;
    }

    Enjoy :)

    Posted 1 year ago #
  2. nice. i think i will snag that at some point.

    Posted 1 year ago #
  3. Just a different version of your Author Box (although no CSS styles). I tinkered around with the structure (going for less divs). Also removed aim, jabber/google talk and yim since I don't know anyone who uses them, replaced them with twitter and facebook. Figured this also might help others and it was something I have been meaning to do and you inspired me.

    // modify user profile contact info in wordpress admin
    // http://wp-snippets.com/addremove-contact-info-fields/
    function childtheme_contactmethods( $contactmethods ) {
        $contactmethods['twitter'] = 'Twitter Username'; // add twitter
        $contactmethods['facebook'] = 'Facebook Link <span class="description">(http:// required)</span>'; // add facebook
    
        unset($contactmethods['yim']); // remove yahoo instant messenger
        unset($contactmethods['aim']); // remove aol instant messenger
        unset($contactmethods['jabber']); // remove google talk / jabber services
    
        return $contactmethods;
    }
    add_filter('user_contactmethods','childtheme_contactmethods',10,1);
    
    // add a author box for thematic above the comment section
    // http://forums.themeshaper.com/topic/thematic-author-box
    function childtheme_authorbox() { ?>
    <div class="authorbox">
        <div class="authorbox-image"><?php echo get_avatar( get_the_author_meta('email'), '80' ); ?></div>
        <div class="authorbox-info">
            <h4><span>About</span> <?php the_author_meta('nickname'); ?></h4>
            <?php if ( get_the_author_meta('description')) { ?>
            <p><?php the_author_meta('description'); ?></p>
            <?php } ?>
            <ul>
                <?php if ( get_the_author_meta('twitter')) { ?>
                <li><a href="http://twitter.com/<?php the_author_meta('twitter'); ?>" target="_blank">@<?php the_author_meta('twitter'); ?></a></li>
                <?php }
                if ( get_the_author_meta('facebook')) { ?>
                <li><a href="<?php the_author_meta('facebook'); ?>" target="_blank">Facebook</a></li>
                <?php }
                if ( get_the_author_meta('url')) { ?>
                <li><a href="<?php the_author_meta('url'); ?>" target="_blank"><?php the_author_meta('url'); ?></a></li>
                <?php } ?>
            </ul>
        </div>
    </div>
    <?php }
    add_action('thematic_abovecomments','childtheme_authorbox',0);

    Technically I could get rid of 2 more divs, but might as well leave those for style if someone decides to go all out that should be enough hooks still. :)

    Posted 1 year ago #
  4. i remember when everybody was on AIM. :)

    Posted 1 year ago #
  5. bogh
    Member

    Good idea on adding/ removing some contactmethods, I'll use that.

    I am 25 and I barely know what AIM is/was :)) , but looking at it's name problably was an instant messenger like yahoo messenger/ skype. But I have to say that I like their website a lot, that is a nice presentation :D

    Thanks for your tips.

    Posted 1 year ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.