Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1927

General Questions/New to Joomla! 5.x • Publish date in all articles but 2?

$
0
0
In my Joomla 5 project, I added a template override for articles.
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:

<?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;}?>
It works well for the Home section. But how do I also make it not show up in the article with the "om-oss" alias?

I tried this solution, but nothing changed:

Code:

<?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;}?>

Statistics: Posted by SocketPup — Sun Apr 07, 2024 7:44 am



Viewing all articles
Browse latest Browse all 1927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>