It all seems to work well, and while I want the published-date to appear in most articles, I also want to omit them in articles that are on my Home section, and in the section with the alias "om-oss."
What I did so far is I replaced the default code for displaying the published-date with this code:
Code: Select all
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
// Check if the active menu item is the default home page
$isDefaultHomePage = $active && $active->home == 1;
if (!$isDefaultHomePage) {
if ($info == 1 || $info == 2) :
if ($useDefList) :
echo LayoutHelper::render('joomla.content.info_block', ['item' => $this->item, 'params' => $params, 'position' => 'below']);
endif;
if ($params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) :
$this->item->tagLayout = new FileLayout('joomla.content.tags');
echo $this->item->tagLayout->render($this->item->tags->itemTags);
endif;
endif;
}
?>
I tried this solution, but nothing changed:
Code: Select all
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
// Check if the active menu item is the default home page
$isDefaultHomePage = $active && $active->home == 1;
// Check if the article alias is "om-oss"
$isOmOssAlias = $app->input->get('alias') === 'om-oss';
if (!$isDefaultHomePage && !$isOmOssAlias) {
if ($info == 1 || $info == 2) :
if ($useDefList) :
echo LayoutHelper::render('joomla.content.info_block', ['item' => $this->item, 'params' => $params, 'position' => 'below']);
endif;
if ($params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) :
$this->item->tagLayout = new FileLayout('joomla.content.tags');
echo $this->item->tagLayout->render($this->item->tags->itemTags);
endif;
endif;
}
?>