Jump to content

Recommended Posts

Posted

Hi Everyone,

I have looked all over these forums for an answer to no avail! I am very new to all this so please bear with me, I have a portfolio page that is showing all of that pages children almost perfectly but it will not show the thumbnail. Here is the code, I know i need to specify the selector but i cant figure out how?

<?php


foreach($page->children as $child)


echo "<li class='{$child->cat}'><a href='{$child->url}'><span>{$child->thumbnail_summary}</span><img src='{$child->url}'><div class='thumb-t'><h3>{$child->title}</h3></div></a></li>";


?>

Thanks!

Posted

on the image src you have the child url, when what you should have is the thumbnail url.

  • Like 1
Posted

Exactly what diogo said. So if your thumbnail image field is called "thumbnail" then replace the img src with $child->thumbnail->url (or if it hasn't been specifically set to only allow one image to be uploaded to that field it might be $child->thumbnail->first()->url if the field is set to allow multiple images).

  • Like 1
Posted

I was on mobile, so the answer was a bit dry. Thanks for completing it Pete.

And welcome to the forum Ollie :)

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...