By Marco Boccanera on Friday, 30 March 2018
Posted in Technical Issues
Likes 0
Views 559
Votes 0
Hello,

is it possible to retrive Post Custom Fields in module "Latest Blogs Module". I think I need to override the file:

ROOT\modules\mod_easybloglatestblogs\tmpl\default_item_content.php

but I cannot understand the code I need to add to retrive post custom fields.

Thank you
Hey Marco,

I am really sorry for the delay of this reply as it is a weekend for us here. You may use the codes below to obtain custom fields from a post,


<?php
$fields = $post->getCustomFields();
?>
<?php if ($fields) { ?>
<div class="eb-entry-fields">
<?php foreach ($fields as $field) { ?>
<?php if ($field->group->hasValues($post)) { ?>
<h4 class="eb-section-heading reset-heading"><?php echo $field->group->getTitle();?></h4>
<ul class="eb-fields-list reset-list <?php echo $this->isMobile() ? 'is-mobile' : '';?>">
<?php foreach ($field->fields as $customField) { ?>

<?php
// retrieve field value
$fieldValue = $customField->getDisplay($post);

// retrieve custom class value for these field
$fieldClassValue = $customField->getFieldClassValue($customField->id, $post->id);
?>

<?php if ($fieldValue) { ?>
<li class="<?php echo $fieldClassValue ? $fieldClassValue : ''; ?>">
<label><?php echo $customField->title;?></label>

<?php if ($customField->type != 'heading') { ?>
<div><?php echo $fieldValue;?></div>
<?php } ?>
</li>
<?php } ?>
<?php } ?>
</ul>
<?php } ?>
<?php } ?>
</div>
<?php } ?>

·
Friday, 30 March 2018 21:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you very much. I really appreciated.
·
Monday, 02 April 2018 16:40
·
0 Likes
·
0 Votes
·
0 Comments
·
You're most welcome, glad to heard your issue resolved.

Just for your information, I have locked and marked this thread as resolved to avoid confusions in the future. Please start a new thread if you have any other issue in the future so it will be easier for us to manage your inquiries.

Thanks for understanding
·
Monday, 02 April 2018 16:44
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post