Automatically Placing AddThis in Every WordPress Post
If you’re like me and are not satisfied with the default position of the AddThis button with the plugin, which is at the bottom of each post, but don’t want to add code manually to each post, don’t get discouraged.
Go to your theme editor and open up single.php (Single Post)
Make sure you have the default AddThis code copied to your clipboard. The code is as follows:
|
<!– AddThis Button BEGIN –> |
Your current single.php should look something like this:
| <?php get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div> <div><?php _e(“Posted by”); ?> <?php the_author() ?> | <?php the_category(‘,’) ?> | <?php the_time(‘l j F Y’); ?> <?php the_time() ?> </div> <div> <?php the_content(__(‘(more…)’)); ?> <div> <?php comments_template(); // Get wp-comments.php template ?> <?php endwhile; else: ?> <?php posts_nav_link(‘ — ‘, __(‘« Previous Page’), __(‘Next Page »’)); ?> <?php get_footer(); ?> |
Place the AddThis code wherever you want –putting it inside the <h2> tag places it in the header of the post, putting it after the </h2> tag will make it appear after the header obviously.
Remember, these are just examples of what your single.php could look like. Different themes have different codes so adjust accordingly and good luck!
Did this work for you or are you still having problems? Leave us a comment below
-
http://www.walkingtaco.com/ Simon

