Subcategory header in the blog category joomla

I would like to show the subcategory name on the Joomla 3.3 category blog page. Got the following suggestion from the link and put it in blog.php file like: /templates/mytemplate/html/com_content/category/blog.php

<?php 
$this->item = &$item;
$subcat = $this->item->category_title;
if ($subcat != $psubcat) :
echo "<h2>" . $subcat . "</h2>";
endif;
$psubcat = $subcat;
?> 

      

Usually this code works, except when we set the host item 1. I tried to set the foreach condition before and after the code something like this:

<?php foreach ($this->lead_items as &$item) : ?>

      

but it doesn't work when we set 1 or more host elements on the category blog layout. So, is there a way to show the subcategory title in the Joomla Category blog layout or what modification do I need to put in the above code to make it work?

+3


source to share


1 answer


There are two places where you will need to add the above code (in the file blog.php

), one in the block of code that displays the lead_items:

<?php if (!empty($this->lead_items)) : ?>

      



And the second one in block code, displaying the input elements:

<?php if (!empty($this->intro_items)) : ?>

      

0


source







All Articles