04
Mar
07

Tutorial: Adding Digg Support to WordPress

What is Digg?

Generally referred to as a social news site, Digg is technically a user-driven news aggregator. Registered Digg users can “digg” (i.e. bookmark and submit) an article on a web page by submitting a URL, along with a brief description. URL submissions are placed on display for other Digg users (registered or not) to read, comment on, rate, and bookmark for themselves.

How Digg can benefit your blog

Two words: heavy traffic. A popular Digg article can easily send thousands of new visitors to a website in a single day. A website does not need an explicit link to Digg in order to receive the benefits of Digg exposure; however, adding a link at the end of every post will give regular and special interest visitors the opportunity to promote an article to a large news-oriented audience. The larger form of the Digg button also specifies the number of times an article has been bookmarked, which can be used as an indicator of its popularity among targeted visitors.

How to add a Digg button to WordPress Posts

Digg support can be added directly to a WordPress blog via editing the PHP code for certain files within the blog’s theme. The main challenge is finding the correct files to edit, since WordPress themes can have different file structures. As such, this tutorial will be more of a strategy for altering a theme to add Digg support. To address most of the common issues users will encounter, a more complicated theme will be altered.

Prerequisites:

  • A WordPress installation with the ability to edit theme files (generally speaking, online services that do not allow you to upload your own themes also won’t let you edit existing theme files)
  • An account with administrator privileges (required for editing theme files)

dw01-1.jpg

dw01-2.jpg

Login to your site using the URL http://www.yoursite.com/wp-admin, where “www.yoursite.com” represents the root directory of the WordPress site. Enter the login and password then click on the Login button.

dw02.jpg

Click on the “Presentation” menu item, located on the top menu bar

dw03.jpg

Click on the Theme Editor menu item, located on the menu bar second from the top.

dw05.jpg

Going forward, the exact instructions may differ depending on the theme being used.

In General two pages need to be altered:

  • The page that contains the main “loop” for the front index of the blog
  • The page that displays content for a single blog post

First, look for the index page. The list of available theme files are listed long the right side of the window. It is best to start by searching a file that contains the term index or main index. In the case of this template (Unnamed One 1.0) the best candidate appears to be “Main Index Template”.

Generally speaking, an article link to digg should be placed directly before or after the content. In WordPress the content for a post is represented by the WordPress tag the_content.

Perform a search for the “the_content” in the index page.

dw05.jpg

Unfortunately, for this WordPress template the content tag does not appear directly in the index page. However, notice there are two PHP include tags for the php pages westagnewstop.php and theloop.php. The latter page sounds like a likely place to find the content tag, since a code loop is used to display each blog post on the front page.

dw06-1.jpg

dw06-2.jpg

Click on theloop.php and once again search for “the_content”.

dw07.jpg

Find the end of the PHP tag containing “the_content” (PHP tags end with the characters ?>). Press the return a key a few times to create space before the subsequent code. Paste the following code in the empty space.

diggcode.jpg

dw08.jpg

Click on the Update File button

dw09.jpg

dw09-2.jpg

Click on the “Preview Site” link at the top of the admin page to preview changes. If the changes were successful, each blog post will be followed by a small digg icon showing the number of diggs that have been performed on the article. The user should also be able to click on the digg icon to submit the blog post to dig. If the blog post already has more than one digg, the region showing the number of diggs should like back to digg.com and shows a description of the article along with any comments from Digg users.

dw10.jpg

At this point, Digg links are available on the site’s index page, but not single-article pages. To add digg links to single-article pages, perform the same tag search and code insertion described above for the single post page. For the template in this example, the page is called “Single Post” but as always the name can change from template to template.

Alternative Methods for Adding Digg to WordPress

Sociable is a WordPress plugin that easily integrates bookmarking to multiple social news sites. Bloggers can configure their sites so that each post contains submission links to del.ici.ous, Digg, Furl, Newsvine, Yahoo MyWeb, Slashdot and dozens of lesser-known social news networks. As of writing, Sociable does not support use of the larger and more descriptive Digg buttons; however, its ease of use and support for multiple news sites may appeal to users who prefer an unobtrusive display or do not wish to edit PHP code.


10 Responses to “Tutorial: Adding Digg Support to WordPress”


  1. 1 BC Mar 4th, 2007 at 8:35 pm

    Good article. I took the pleasure of Digg’ing and putting on my blog.
    http://make-this-work.com/blog

  2. 2 Srikanth Eswaran Sep 22nd, 2007 at 1:44 am

    hello there

    if the rest of the people in the word were to be as plain vanilla in terms of explaining this article as you, the world would be a much better place :)

    cheers and all the best.
    do write a lot many such articles. this is the best i ve seen till now.

  3. 3 Srikanth Eswaran Sep 22nd, 2007 at 1:44 am

    hello there

    if the rest of the people in the word were to be as plain vanilla in terms of explaining this article as you, the world would be a much better place :)

    cheers and all the best.
    do write a lot many such articles. this is the best i ve seen till now.

  4. 4 Sujoy Nov 14th, 2007 at 12:37 am

    Great post, useful and easy to understand. Thanks to you I now have it all up and running.

    cheers mate!

  5. 5 Alcolftottbig Dec 6th, 2007 at 1:33 am

    Hi,

    ever wondered how to get better Amazon deals or how to get that 30-day refund from Amazon?

    We discovered a gret service which tracks prices for you and alerts youl.

    Check out our latest review at:

    http://bargains-hunter.blogspot.com/2007/12/apnoticom-review.html

  6. 6 Jeremy Jan 5th, 2008 at 1:00 pm

    Now why couldn’t Digg document this so clearly? It’s all in the permalink function. Thanks!

  7. 7 CarolSosa May 15th, 2010 at 4:48 am

    I propose not to hold off until you earn big sum of money to buy different goods! You should take the credit loans or consolidation loans and feel comfortable

  1. 1 Tutorial: Adding Digg Support to Wordpress at BC Blog Pingback on Mar 4th, 2007 at 7:44 pm
  2. 2 Jack’s Newswatch Pingback on Mar 5th, 2007 at 4:31 pm
  3. 3 Very basic code questions - Bloggeries Blog Forum Pingback on Jun 4th, 2007 at 6:23 pm

Leave a Reply

 



Further Research

Twitter

Archives

Categories