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
4 years 11 months ago #173837 by Dayyal Dg.
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.

More
4 years 11 months ago #173883 by JoomlaWorks
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.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum