jmn817 Posted February 2, 2017 Share Posted February 2, 2017 Hi, I'm having some issues with one of my foreach loops that are not linking correctly. The goal is on a parent page to show the recent articles (the children) in a grid that displays the image, title, and link to the respective article. Almost everything works, I'm able to display the child's image and title fields, but the only thing that is not working is the url. It always links back to the parent page (or the page where the grid is). <?php foreach ($page->children('limit=10') as $child): ?> <div class="gridcontainer"><br><img class="gridimages" src="<?php echo $child->article_image->url; ?>" /><br> <br><div class="gridtitles"><a href="<?php $child->url; ?>" > <?php echo $child->title; ?> </a></div><br> </div> <?php endforeach; ?> My code is above, and I'm just not sure what I'm doing wrong with this approach. Thank you for your time. Jesse Link to comment Share on other sites More sharing options...
Robin S Posted February 2, 2017 Share Posted February 2, 2017 You are missing an echo statement: 44 minutes ago, jmn817 said: <a href="<?php $child->url; ?>" > 3 Link to comment Share on other sites More sharing options...
jmn817 Posted February 2, 2017 Author Share Posted February 2, 2017 @Robin S It's always embarrassing when it's that easy, can't believe I overlooked that. Thanks for the help! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now