I am after some guidance with the following HTML to WordPress conversion.

Based on the linked image (see HTML Divs screen image), which has the following three divs, which will be individual pages within my WordPress site, after conversion, i.e.:

see:> html Divs

1) Solar Pool Heating
2) Domestic Hot Water &
3) Solar Electric

Can somebody please let me know how through the use of the WordPress loop and built in functions, I can obtain the image for each div from the main page as well as an excerpt of the page content for each of the divs together with the "Read More" which would then take me to the actual page to read all of the page?

I'm not sure if this is possible but I have always wanted to know how this can be done as this would assist my understanding of this area.

Hopefully someone can assist.


1 Answer 1


You can load content from other pages via the get_pages function:

$args = array(
    'sort_column' => 'menu_order',
    'include' => array( 5, 6, 7 ) // your page IDs
$my_pages = get_pages( $args );

foreach( $my_pages as $page ){
    setup_postdata( $page );
  • Thanks Milo but can I ask you a few queries, how does the_post_thumbnail() function work - does it just grab any image attached to that page id? Also, how does the_excerpt() function work - say I just want to pick up the first 50 chars of the page id, which may consist of two paragraphs in that 50 chars? Does a substr() need to be performed or does the excerpt get placed elsewhere? Thanks. Mar 20, 2012 at 23:53
  • @softprinciples see the_excerpt, the_post_thumbnail, and Post Thumbnails in codex.
    – Milo
    Mar 21, 2012 at 0:35
  • unfortnately I cannot get the get_pages to work for me. Tried the code above and it didn't retrieve back anything? Any help would be appreciated. thanks. Mar 23, 2012 at 14:08
  • @softprinciples - did you change the page ids to your pages? I'd have to see it in context as it works for me. what do you see when you print_r($my_pages); after the get_pages call?
    – Milo
    Mar 23, 2012 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.