Keyword

How to load item extra fields and item create date in LATEST ITEMS FROM AUTHOR

  • Dayyal Dg.
  • Dayyal Dg.'s Avatar Topic Author
  • Offline
  • New Member
More
1 week 5 days ago #173837 by Dayyal Dg.
Dayyal Dg. created the topic: How to load item extra fields and item create date in LATEST ITEMS FROM AUTHOR
Dear sir,

I want to show item Extra Fields and item create date, under Latest Item From Author in the item view (template override). I tried the below code for loading a specific field but not working.

<?php if($item->extraFields->size->value != ''): ?>
<span><?php echo $item->extraFields->size->value; ?></span>
<?php endif; ?>

And this code for loading item created date.

<span><?php echo JHTML::_('date', $item->created, 'd F Y'); ?></span>


Here are the complete codes:

<?php if($this->item->params->get('itemAuthorLatest') && empty($this->item->created_by_alias) && isset($this->authorLatestItems)): ?>
<!-- Latest entry from author -->
<div class="downloadMore">
<div class="downloadMoreHeader">
<h2><span>Recently Added</span></h2>
</div>
<div class="downloadMoreInner">
<div class="slick-slider">
<?php foreach($this->authorLatestItems as $key=>$item): ?>
<div class="slide <?php echo ($key%2) ? "odd" : "even"; ?>">
<a href="<?php echo $item->link ?>">
<figure><img src="<?php echo $item->imageXSmall; ?>" class="dImg" /></figure>
<span class="title"><?php echo $item->title; ?></span>
</a>

<div class="_11SJc">
<div class="_2SwlV">
<span><?php echo $item->hits; ?> views</span></div>
<div class="_2ANKF">
<span class="_BOPS"><?php echo JHTML::_('date', $item->created, 'd F Y'); ?></span></div>
</div>

<?php if($item->extraFields->size->value != ''): ?>
<span><?php echo $item->extraFields->size->value; ?></span>
<?php endif; ?>

<div class="downloadMoreFooterOuter">
<span class="downloadMoreFooter"><i class="amazonAffiliate"></i></span>
<span class="downloadMoreFooter"><button type="button" class="btn">More</button></span>
</div>

</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Online
  • Administrator
  • JoomlaWorks Support Team
More
1 week 3 days ago #173883 by Fotis
Fotis replied the topic: How to load item extra fields and item create date in LATEST ITEMS FROM AUTHOR
Do a var_dump($item) inside the foreach loop to get all available fields. If we render them all (I believe we do), then you'll be able to display them with $item->whatever.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum