You will see that many websites add a digg button inside their put up content material. Some new customers merely open single.php and add the digg script which can trigger a digg button to present on all weblog posts. But what in order for you to show digg button on solely particular posts? You can add it manually on every put up when writing a put up, however that’s not essentially the most environment friendly manner. In this text we are going to present you, how one can add a digg button on particular posts by merely using Custom fields.
First open your single.php and discover a code that appears like this:
<?php if (have_posts()) : whereas (have_posts()) : the_post(); ?>
Replace it with:
<?php if (have_posts()) : whereas (have_posts()) : the_post(); // examine for digg button for single web page $digg = get_post_meta($post->ID, 'Digg', $single = true); ?>
Now you want to add the next code inside the loop anyplace you want:
You could wrap it round with any styling that you really want. Save the single.php and add it to your theme folder.
Now when writing a put up in order for you to add a digg put up merely add a customized area like proven in the display shot beneath:
Whenever you specify this practice area, WordPress will show a digg button on your put up like this one:
Check out this instance (Live)