Showing posts with label wordpress. Show all posts
Showing posts with label wordpress. Show all posts

Thursday, March 1, 2012

Separate-Comments-and-Trackbacks-in-wordpress

How to Separate Comments and Trackbacks [WordPress Tips]


Most wordpress themes out there (by default) combine both comments and trackbacks / pingbacks together and display under the same list. But why bother separating them? Simply to make things looks more organize so your blog commenters have a clearer picture what are the comments, what’s not. Doing it is not hard, but you need toe be using independent WordPress blog (not the wordpress.com), provided with access to change comments.php.

 Prepare your favorite editor, and here we go.


You will be adding and editing you comments.php. So do a backup of that file before you start amending it.

Step 1

Look for:
<?php foreach ($comments as $comment) : ?>

Paste after:
<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type == 'comment') { ?>

Step 2

Look for:
<?php endforeach; /* end for each comment */ ?>

Paste before:
<?php } else { $trackback = true; } /* End of is_comment statement */ ?>
 

Step 3

Look for:
<?php else : // this is displayed if there are no comments so far ?>

Paste before:
<?php if ($trackback == true) { ?>
  <h3>Trackbacks</h3>
  <ol>
  <?php foreach ($comments as $comment) : ?>
  <?php $comment_type = get_comment_type(); ?>
  <?php if($comment_type != 'comment') { ?>
  <li><?php comment_author_link() ?></li>
  <?php } ?>
  <?php endforeach; ?>
  </ol>
<?php } ?>
That’s it. Update your blog and you’ll notice Trackbacks have been pulled out from comments and displayed underneath. If you want to display Trackbacks before comments. the easiest way is adding <div> to both and control the style via CSS.

Enjoy...
Don't forget to like and comment...:)

Display-Feedburner-Subscriber-Count-in-text

How To Display Feedburner Subscriber Count In Text



I believe you’ve seen websites and blogs that uses the text-based Feedburner subscriber count instead of the chicklet. I hope you are not getting the idea the these guys update their feed count manually. Instead, it can be done easily with scripts, and the reason why you want to do is – it gives you total flexibility in terms of design, styling and display.

Step 1

Copy paste the following code into your template, replace feedburner-id with your Feedbuner username. This script will grab you the feed count in numbers.
view plaincopy to clipboardprint?



//get cool feedburner count 
$whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=feedburner-id"; 
 
//Initialize the Curl session 
$ch = curl_init(); 
 
//Set curl to return the data instead of printing it to the browser. 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
 
//Set the URL 
curl_setopt($ch, CURLOPT_URL, $whaturl); 
 
//Execute the fetch 
$data = curl_exec($ch); 
 
//Close the connection 
curl_close($ch); 
$xml = new SimpleXMLElement($data); 
$fb = $xml->feed->entry['circulation']; 
//end get cool feedburner count 



Step 2

Paste this anywhere you want and it’ll display a Feedburner subscriber count in text.
view plaincopy to clipboardprint?

echo $fb; 

To style it nicely with your website or blog’s theme, add <p> or <div> and tweak the CSS accordingly.

Enjoy...
Don't forget to like and comment...:)

Related Posts Plugin for WordPress, Blogger...

 
Design by ItRocks Softcom | Bloggerized by ItRocks