Jump to content
Sign in to follow this  
bobborsongmailcom

Adding a Stumbleupon badge

Recommended Posts

bobborsongmailcom

I wanted to add a Stumbleupon badge that had a counter in it - I generated the code from the Stumblupon site - <script src="http://www.stumbleupon.com/hostedbadge.php?s=5"></script> and this is their instructions on where to place it - Edit single.php of your WordPress theme. Find the following line (or similar line, depending on your theme file) in single.php or theloop.php: <?php the_content("<p class=serif>Read the rest of this entry</p>"); ?> Immediately after the line, add the code above: Save and upload single.php back to your WordPress theme folder. Done! I tried inserting it in the _posts.php file but I get varied results based on where you look. I get one value if you are just on my landing page, I get a different set of results if you come directly to the post, and a third set of results if you select a tag and get a bunch of posts to view. I have left it in place for you to see. My website is - www.lifeofanarchitect.com Thanks

Share this post


Link to post
Share on other sites
cmunns

Likely it just depends on where the user was when they stumbled it. If that doesn't seem right is there a troubleshooting guide somewhere on how that bit of code is supposed to work?

Share this post


Link to post
Share on other sites
bobborsongmailcom

The instruction I pasted above are from the troubleshooting section. Since iBlogPro4 doesn't have a single.php file, is the _posts.php file the correct equivalent?

Share this post


Link to post
Share on other sites
cmunns

Yes that is correct, but depending on where you put it it will show up in different places. Can I see a snippet of where you placed it? (I don't need to see the entire template code )

Share this post


Link to post
Share on other sites
bobborsongmailcom

I have a friend who used this on his wordpress site and the counter/submit button only shows up on the individual posts page - http://extremelyaverage.com/ Here is the bit from _posts.php file <div class="metabar"> <?php _e('On',TDOMAIN);?> <?php the_time(get_option('date_format')); ?>, <?php _e('in',TDOMAIN);?> <?php the_category(', ') ?>, <?php _e('by',TDOMAIN);?> <?php the_author(); ?> <?php edit_post_link(__('(Edit Post)', TDOMAIN), ' ', ' ');?> </div> </div> </div> <!--/post-title --> <script src="http://www.stumbleupon.com/hostedbadge.php?s=5"></script> <?php if(pl_show_excerpt($post->ID)):?> <div class="post-excerpt"> <?php the_excerpt(); ?> </div> <?php endif; ?> </div>

Share this post


Link to post
Share on other sites
cmunns

Try encapsulating the stubmleupon code with this: ` <?php if(is_single()):?> stumble code <?php endif;?> `

Share this post


Link to post
Share on other sites
bobborsongmailcom

That did it - thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×