1

I want to make an author box like this : enter image description here

<table style="border: solid 1px #ffffff;width:100%;">
        <tbody>
        <tr>
        <td>
        <h3><b><span style="color: #555; ">About Author</span>&nbsp;</b>
        <input type="hidden" name="stats" value="2498">
        </h3>you can be an author too, join mhktricks and show you skills</td>
        <td style="border: solid 1px #ffffff;" align="right">
        <a href="http://mhktricks.net/user-registration/" target="_blank">
        <input class="p2graybtn" style="height: 26px; width:150px;" type="button" value="Join Us">
        </a>
        </td>
        </tr>
        </tbody>
        </table>
        <hr>
        <table style="border: solid 1px #ffffff;">
        <tbody>
        <tr>
        <td>

        <?php echo get_avatar( get_the_author_meta( 'user_email' ), 70 ); ?>
        </td>
        <td style="border: solid 1px #ffffff;">
        <table style="border: solid 1px #ffffff;">
        <tbody>
        <tr>
        <td>
        <span style="color: #555;font-size:20px;font-family: Open Sans;font-weight: 400;font-style: normal;text-decoration: none;">
        <?php echo get_the_author(); ?>
        </span>
        <br><div style="margin-left:1px;">
        <?php echo get_author_role(); ?>

        <span style="position:relative;top:1px;margin-left:5px;"><img src="http://i2.wp.com/codex.onhax.net/img/verified.png" height="12" width="12"></span>
        </div>
        </td>
        <td style="border: solid 1px #ffffff;">
        <div style="margin-left: 3px;margin-top: -17px;border: #B8B8B8 1px solid;border-radius:2px;padding: 0px 5px 0px 5px;font-size:10px;">
        <?php the_author_posts(); ?> POSTS</div>';
        </td>
        </tr>
        </tbody>
        </table><div style="margin-top:-12px;">&nbsp;
        </div>
        <div style="margin-left:3px;margin-top:2px;padding-right:60px;">
        <?php the_author_meta( 'description' ); ?> 
        <a class="author-link" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
           View all posts by me 
        <?php get_the_author(); ?>
        <span class="meta-nav">&rarr;</span>
        </a>        
        </div>
        </td>   
        </tr>
        </tbody>
        </table>
        <hr color="white">
        <hr color="white">
        <table style="border: solid 1px #ffffff;width:100%;">
        <tbody>
        <tr>
        <td>
        <h3><b><span style="color: #555; ">Discussion</span></b></h3>
          share your knowledge.mind to help others</td>
        <td style="border: solid 1px #ffffff;" align="right">
        <a href="#" class="show-comments">
        <input class="p2graybtn" style="height: 26px;" type="button" value="Toggle Comments">
        </a>
        </td>
        </tr>
        </tbody>
        </table>

I have made upto this but how to insert it in every post ?

1

I've not tested your code; but assuming it's correct and working well, edit your single.php file and insert this code just after the point where you end your post content and before the Comment Section starts.

I'd suggest to write this Author Box code in a separate file and then use get_template_part to insert the Author Box section in your Post. See this function Reference page if you're new to the get_template_part function.

1
  • When I add it in my single.php it appears below comment box & I can't add it in between , I am using P2 theme – mhktricks.net Mar 7 '15 at 6:38
0

you can do with the_content filter.

add_filter( 'the_content', 'my_the_content_filter', 20 );
function my_the_content_filter( $content ) {

  if ( is_single() ) {
      $content = $content . "YOUR_HTML_FOR_BOX";
  }

  // Returns the content.
  return $content;
}
1
  • This code is not working , please help – mhktricks.net Mar 7 '15 at 6:40
0

Just add bellow code into function.php file.

function add_author_content($content)
{
  $author = get_the_author();
  $content = $content.' - '.$author;
  return $content;
}
add_filter('the_content', 'add_author_content');
3
  • Where to add my code ? – mhktricks.net Mar 7 '15 at 6:40
  • Mentioned code add into 'function.php' add showing code into your page.php,single.php or other template 'apply_filters('the_content', $post_content);' – Jakir Hossain Mar 7 '15 at 6:57
  • No I mean I want to add table in author box – mhktricks.net Mar 7 '15 at 7:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.