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&#91;'post_title'&#93;!='Auto Draft'):?>

<li class="item">
            <a href="<?php echo $this->getUrl('blog/').$row['post_name'];?>"> <?php echo $row&#91;'post_title'&#93;;?></a>
            </li>

            <?php endif; ?>
            <?php endforeach; ?>
        </ul>

    </div>

</div>


Categories: Magento

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *