test
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • Sima Friend
    #1052411

    Hello, I am trying to replace the intro image by a Joomla custom field image I created. I was trying to accomplish this in the following override:

    /html/com_content/category/blog_item.php

    I tried to do it based on this article: Getting custom fields in your override but I am not having any luck getting it to work.

    Any help would be very much appreciated.

    Saguaros Moderator
    #1052625

    Hi Sima,

    The intro image has override in layout here: [root]/plugins/system/t3/base-bs3/html/layouts/joomla/content/intro_image.php

    I’m not quite sure of how you want to achieve with custom field for this.

    Sima Friend
    #1053928

    Here is how to do it:

    First create a custom field and choose "Media" as the field type. Under options turn off the Automatic Display and set it to none.

    In your article under the fields tab select an image from the custom field you just created.

    Go to line 40 in the following override:

    /html/com_content/category/blog_item.php

    and replace

    <?php echo JLayoutHelper::render('joomla.content.intro_image', $this->item); ?>

    with

    <div class="pull-left item-image"><?php foreach($this->item->jcfields as $field): ?>
    <?php if($field->type == 'media'): ?>
    <?php echo $field->value; ?>
    <?php endif; ?>
    <?php endforeach; ?></div>

    It will now show the image from your custom field as the intro image instead of the default intro image.

    Saguaros Moderator
    #1054077

    Did you try with standard template of Joomla like: Beez / Protostar? I just tried to add media custom field type for JA Alumni but it works.

    Sima Friend
    #1054081

    No, I did it with JA Alumni.

    Saguaros Moderator
    #1054090

    You can try with standard template of Joomla to make sure that your override works with default Joomla first.

Viewing 6 posts - 1 through 6 (of 6 total)

This topic contains 5 replies, has 2 voices, and was last updated by  Saguaros 7 years, 3 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum