I know this not the right way but you can get the functionality by following the steps:
Navigate to your Theme Folder open the file posts.phtml
app/design/frontend/your-package/your-theme/template/wordpress/sidebar/widget
and add the following code before
<?php endif; ?>
The code:
<div class="block block-blog block-recent-posts">
<?php $resource = Mage::getSingleton('core/resource'); $readConnection = $resource->getConnection('core_read');
$query = "SELECT `id`, `post_title`,`post_name` , `comment_count` FROM `wp_posts` WHERE `post_type`='post' ORDER BY `comment_count` DESC LIMIT 10";
$results = $readConnection->fetchAll($query);
?>
<div class="block-title">
<?php echo $this->__('Popular Post'); ?>
</div>
<div class="block-content">
<ul>
<?php foreach($results as $row):?>
<?php if($row['post_title']!='Auto Draft'):?>
<li class="item">
<a href="<?php echo $this->getUrl('blog/').$row['post_name'];?>"> <?php echo $row['post_title'];?></a>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
</div>
0 Comments