<?xml version="1.0" encoding="UTF-8"?>
<codes type="array">
  <code>
    <code>&lt;ul&gt;
&lt;?php $result = $wpdb-&gt;get_results(&quot;SELECT comment_count,ID,post_title FROM $wpdb-&gt;posts ORDER BY comment_count DESC LIMIT 0 , 5&quot;);
foreach ($result as $post) {
setup_postdata($post);
$postid = $post-&gt;ID;
$title = $post-&gt;post_title;
$commentcount = $post-&gt;comment_count;
if ($commentcount != 0) { ?&gt;
&lt;li&gt;&lt;a href=&quot;&lt;?php echo get_permalink($postid); ?&gt;&quot; title=&quot;&lt;?php echo $title ?&gt;&quot;&gt;
&lt;?php echo $title ?&gt;&lt;/a&gt; {&lt;?php echo $commentcount ?&gt;}&lt;/li&gt;
&lt;?php } } ?&gt;
&lt;/ul&gt;</code>
    <created-at type="datetime">2009-08-22T15:30:43Z</created-at>
    <description></description>
    <id type="integer">196</id>
    <language-id type="integer">35</language-id>
    <privated type="boolean">false</privated>
    <title>wordpress popular posts</title>
    <updated-at type="datetime">2009-08-22T15:30:43Z</updated-at>
    <user-id type="integer">7</user-id>
  </code>
  <code>
    <code>function getShortUrl($url) {
  $tinyurl = file_get_contents(&quot;http://tinyurl.com/api-create.php?url=&quot;.$url);
  return $tinyurl;
}</code>
    <created-at type="datetime">2009-04-26T14:42:42Z</created-at>
    <description>paste the function in function.php file and call in you template with:

&lt;?php echo '&lt;a href=&quot;'.getShortUrl(get_permalink($post-&gt;ID)).'&quot;&gt;short url&lt;/a&gt;'; ?&gt;</description>
    <id type="integer">172</id>
    <language-id type="integer">35</language-id>
    <privated type="boolean">false</privated>
    <title>short url in wordpress with tinyurl</title>
    <updated-at type="datetime">2009-04-26T14:42:42Z</updated-at>
    <user-id type="integer">7</user-id>
  </code>
  <code>
    <code>// comments_count
function comments_count() { 
    global $wpdb; 
    $count = &quot;SELECT COUNT(*) FROM $wpdb-&gt;comments WHERE comment_approved = '1'&quot;; 
    echo $wpdb-&gt;get_var($count); 
} 
// &lt; ?php comments_count() ?&gt; comments

// posts_count
function posts_count() { 
    global $wpdb; 
    $count = &quot;SELECT COUNT(*) FROM $wpdb-&gt;posts WHERE post_status = 'publish'&quot;; 
    echo $wpdb-&gt;get_var($count); 
} 
// &lt;?php posts_count() ?&gt;&lt;/strong&gt; articles

// retro_count
function retro_count() { 
    global $wpdb; 
    $count = &quot;SELECT COUNT(*) FROM $wpdb-&gt;comments WHERE comment_type = 'pingback'&quot;; 
    echo $wpdb-&gt;get_var($count); 
} 
// &lt; ?php retro_count() ?&gt; pingbacks
</code>
    <created-at type="datetime">2008-11-18T02:26:17Z</created-at>
    <description>for example: save all functions in 'your_theme/stats.php'</description>
    <id type="integer">107</id>
    <language-id type="integer">35</language-id>
    <privated type="boolean">false</privated>
    <title>wordpress functions to count posts</title>
    <updated-at type="datetime">2008-11-18T02:26:17Z</updated-at>
    <user-id type="integer">7</user-id>
  </code>
</codes>
