Flat 60% off on Everything
Days
Hrs
Welcome,
Guest
|
|
HI, is there a way to show the year as well in the blog categories.
if you look at : demo.joomdev.com/medical/toolbar/index.php/blog the article has date 27/Jun in the right top corner of the image. I would like to display the year as well. Thanks, Peter |
The administrator has disabled public write access.
|
|
Hi Peter,
This is surely possible by modifying some code here and there. A little background on this. The Blog page is built using K2, Below I am going to provide you overrides code for K2 category item layout (lists items on blog page) and K2 item (Individual Blog items). Blog layout example: demo.joomdev.com/medical/toolbar/index.php/blog Individual Item layout example : demo.joomdev.com/medical/toolbar/index.p...-green-cleaning-goal You need to modify the following files: templates/jd_medical/html/com_k2/templates/default/category_item.php <span class="catItemDateCreated">
<span class="date"><?php echo JHTML::_('date', $this->item->created , JText::_('d')); ?></span>
<span class="month"><?php echo JHTML::_('date', $this->item->created , JText::_('M')); ?></span>
</span> to: <span class="catItemDateCreated">
<span class="date"><?php echo JHTML::_('date', $this->item->created , JText::_('d')); ?></span>
<span class="month [b]date[/b]"><?php echo JHTML::_('date', $this->item->created , JText::_('M')); ?></span>
[b]<span class="year"><?php echo JHTML::_('date', $this->item->created , JText::_('Y')); ?></span>[/b]
</span> Added the year span to display the year. Same changes are to be done in file item.php in the same directory around line 83 (search for div itemDateCreated). and replace code: <span class="itemDateCreated">
<span class="date"><?php echo JHTML::_('date', $this->item->created , JText::_('d')); ?></span>
<span class="month"><?php echo JHTML::_('date', $this->item->created , JText::_('M')); ?></span>
</span> with: <span class="itemDateCreated">
<span class="date"><?php echo JHTML::_('date', $this->item->created , JText::_('d')); ?></span>
<span class="month"><?php echo JHTML::_('date', $this->item->created , JText::_('M')); ?></span>
<span class="year"><?php echo JHTML::_('date', $this->item->created , JText::_('Y')); ?></span>
</span> Here is a screenshot of what it looks like: |
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.
Last Edit: 2 years 10 months ago by admin.
The administrator has disabled public write access.
The following user(s) said Thank You: pete
|
|
Nice,
thanks... one small correction. in your code for catItemDateCreated you have: [b]<span class="year"><?php echo JHTML::_('date', $this->item->created , JText::_('Y')); ?></span>[/b] the and showed up on the page, so removing them does the trick... cheers. Peter One more thing. I'm trying to change the blog menu behaviour. When I open blog (top menu), I want to see all articles regardless of category, sorted by latest first. The categories can be still open from the list on the right. I had partial success, where I change the Blog menu to list all articles form all categories. It still gives me the articles by categories but there are all of them. Btw, the date in the corner is not visible in this mode. I'm not sure, which file I need to update. |
The administrator has disabled public write access.
|
|
Glad, the date issue worked out Pete.
I'll test the issue about all categories too and see if that is something that can be fixed in the next release of the template. For the movement, I'd recommend keeping the menu item to list by categories/user by selecting all categories instead. In this case, the ordering settings are then taken over by menu and not individual category and you will have easier time managing the ordering of the items displayed on the page. |
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.
The administrator has disabled public write access.
|
|
Yep,
that's what I'm doing. I did list by categories. It's not perfect, but it has to do for now. Btw, when I do that it doesn't show the date in the corner... Is this menu driven by different template? Pete |
The administrator has disabled public write access.
|
|
Should be the same template Pete. I'll give it another try and see if there is anything that needs update and get that out of the way.
Thanks, |
Thank You,
If you like our support and products, tweet us at joomdev and let the world know about it.
The administrator has disabled public write access.
|
JoomDev is not affiliated with or endorsed by Open Source Matters or the Joomla! Project. The Joomla! logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
Powered by Astroid Framework © 2021 JoomDev. All Rights Reserved.