Tag Archives: Blog

How can create custom sidebar category menu for AW Blog

1. Create a menu_cat.phtml file in app\design\frontend\default\default\template\aw_blog

<div class=”block block-blog”>
<div class=”block-title”>
<strong><span><?php echo Mage::getStoreConfig(‘blog/blog/title’); ?></span></strong>
</div>
<div class=”block-content”>

<?php

$collection = Mage::getModel(‘blog/cat’)
->getCollection()
->addStoreFilter(Mage::app()->getStore()->getId())
->setOrder(‘sort_order’, ‘asc’)
;
$home_url = Mage::helper(‘core/url’)->getHomeUrl();
?>
<?php if ($collection->count() ): ?>
<div class=”menu-categories”>
<h5><?php echo Mage::helper(‘blog’)->__(‘Categories’); ?></h5>
<ul>
<?php  foreach ($collection as $item) : ?>
<li><a href=”<?php echo $home_url.’blog/cat/’.$item[‘identifier’]; ?>” ><?php echo $item[‘title’]; ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>

</div>
</div>

2. Create a static block from admin side and a following code in content.

<p>{{block type=”blog/blog” template=”aw_blog/menu_cat.phtml”}}</p>

3. Put below code in 2columns-right.phtml or 2columns-left.phtml

<?php

echo $this->getLayout()->createBlock(‘cms/block’)->setBlockId(‘block_identifier_name’)->toHtml();

?>