Answer the question
In order to leave comments, you need to log in
How to display description in K2 joomla material?
joomla 3.9
K2 2.9
I display a material that has its own description and keywords, but displays the description of the material from the category in which it lies. Tell me how to fix it? Googled, found one answer, marked as solved, but for some reason the solution does not suit me.
Z.Y. In the K2 category itself, description is not specified, but is specified for the menu item in which the category is displayed.
Answer the question
In order to leave comments, you need to log in
I'll answer myself, my solution is the following:
in the file /components/com_k2/views/item/view.html.php
somewhere near line 420, we find the code responsible for checking and outputting description. It looks like this:
if ($params->get('menu-meta_description')) {
$document->setDescription($params->get('menu-meta_description'));
}
if ($params->get('menu-meta_keywords')) {
$document->setMetadata('keywords', $params->get('menu-meta_keywords'));
}
if ($params->get('menu-meta_description') && (!$document->setDescription($item->metadesc))) {
$document->setDescription($params->get('menu-meta_description'));
}
if ($params->get('menu-meta_keywords') && (!$document->setMetadata('keywords', $item->metakey))) {
$document->setMetadata('keywords', $params->get('menu-meta_keywords'));
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question