Web357 logo

Multiple Categories for K2 - Frequently Asked Questions


How to display the multiple categories at K2 User's page?

In order to show the multiple categories in User's page, you should edit the k2 template files.

Open the file /components/com_k2/templates/_TEMPLATE_/user.php.

FIND:

<div class="userItemCategory">
	<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
	<a href="/<?php echo $item->category->link; ?>"><?php echo $item->category->name; ?></a>
</div>

REPLACE WITH:

<?php
// BEGIN: Multiple Categories for K2, by Web357
$w357_dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin ('k2multiplecategories');
$k2multiplecategories = $w357_dispatcher->trigger('onK2AfterDisplayContentAdvanced', array($item));
if (!empty($k2multiplecategories) && is_array($k2multiplecategories)):
?>
	<!-- Item category name -->
	<div class="userItemCategory">
		<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
		<?php echo $k2multiplecategories[0]; ?>
	</div>
<?php else: ?>
	<!-- Item category name -->
	<div class="userItemCategory">
		<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
		<a href="/<?php echo $item->category->link; ?>"><?php echo $item->category->name; ?></a>
	</div>
<?php endif; // END: Multiple Categories for K2, by Web357 ?>

 

Stay tuned

We are always working on something new and exciting so make sure to subscribe to our newsletter and be the first to know.