• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

How to Add a Digg Button in your WordPress using Custom Fields ...

You will see that many sites add a digg button within their post content. Some new users simply open single.php and add the digg script which will cause a digg button to show on all blog posts. But what if you want to display digg button on only specific posts? You can add it manually on each post when writing a post, but that is not the most efficient way. In this article we will show you, how you can add a digg button on specific posts by simply using Custom fields.

First open your single.php and find a code that looks like this:

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

Replace it with:

    <?php if (have_posts()) : while (have_posts()) : the_post();
    // check for digg button for single page
    $digg = get_post_meta($post->ID, Digg, $single = true);
    ?>

Now you need to add the following code within the loop anywhere you like:

    <?php // if there is a single page digg button
    if($digg !== ) { ?>
    <script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
    <?php } // end if statement
    // if there is not a digg button
    else { echo ; } ?>

You may wrap it around with any styling that you want. Save the single.php and upload it to your theme folder.

Now when writing a post if you want to add a digg post simply add a custom field like shown in the screen shot below:

Whenever you specify this custom field, WordPress will display a digg button on your post like this one:

Check out this example (Live)

 Original Source:
http://www.wpbeginner.com/wp-tutorials/how-to-add-a-digg-button-in-your-wordpress-using-custom-fields/

AddThis Social Bookmark Button

Posted at 12:51:58 pm | Permalink | Posted in Digg  

Related Stuff

Google Buzz Button Wordpress Plugin Released

If you are looking for a Google Buzz button to add into your Wordpress site then we have released the first Wordpress plugin exclusively ...

Plug And Play Ecommerce With Wordpress Plugins

Since 2003 Wordpress has slowly been gaining popularity amongst the elite of the internet, the bloggers. It is one of those few things ...

Add Google Search to Your WordPress Blog

The native WordPress search does not return very relevant results, thus it makes a lot of sense to add Google Search into your WordPress ...

Add More Sidebars to Your WordPress Theme

You can add more than one sidebar section to your WordPress site. For example, with the stc-intermountain.org site, I added a whole bunch ...

Series Posting in Wordpress

In my functions.php file, I have some code which implements series posting. This relies on the thematic ...

Top Stuff

Free Blogger templates Anime Themes

Wordpress Guestbook Generator Plugin

48 Unique Ways To Use WordPress

GeekLog

WordPress Single Post Templates

Get The Image WordPress Plugin



About Webloglines

Webloglines is a project offers a comprehensive collection of blogging services, articles, themes and plugins from around the world. Whether you're looking to promote your own blog or find blogs on various topics, this site is for you.


Search


Topics

  • Adsense (12)
  • Blogging Tips (73)
  • Blogs Slides (25)
  • Blogs Websites (22)
  • Digg (20)
  • How to Blog (129)
  • Search Engines (9)
  • SEO (135)
  • WordPress Plugins (269)
  • WordPress Security (75)
  • Wordpress Themes (99)
  • Wordpress Tips (162)

© 2006 www.webloglines.com. All Rights Reserved. Powered by IRange