Support » Themes and Templates » Landing Page – Using Featured Image of Child Pages

  • Resolved Richard Saunders

    (@proudlywelsh83)


    Good Morning,

    I’m trying to create a page template that outputs the page content, followed by the Title / Excerpt / Featured Image of any child pages of the parent.

    I’ve successfully generated a template that outputs the content from the child pages that I require, however I’m unable to output ‘the_content’ of the parent page.

    I’ve provided the template code in a pastebin.

    http://pastebin.com/inQB2FCe

    As ‘the_title’ of the parent page is output, i’d have expected ‘the_content’ on line 16 to output the parent page content.

    Any help anyone could provide would be greatly appreciated.

    Kindest Regards

    Richard

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Richard,

    This is because you haven’t set up The Loop for the template.

    I’ve posted a modified version of your code here. Notice the main loop on line 11, and specifically the call to the_post(), which sets up the post (or in this case, page) data so that functions such as the_content() can be called.

    You could probably get away without using The Loop, and only calling the_post(), but it’s generally considered good practice to use The Loop.

    Ross,

    Not sure how I managed to miss that. Thanks for your quick response, this has done the trick.

    Regards

    Richard

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Landing Page – Using Featured Image of Child Pages’ is closed to new replies.