• Fellow wordpressers,

    After scratching my head for a little while, I have placed an unordered list into one of my sidebar widgets (one of many) as follows. (# replaces the actual page ID)

    <div>
                   <ul class="links">
    
    <?php wp_list_pages("depth=1&title_li=&sort_column=menu_order&child_of=#"); // display ONLY the sub pages of page xxx ?>
    
    <?php end ?>
         </ul>
    	</div>

    Each page concerned has a featured thumbnail attached to the page and I would like to incorporate the thumbnail into the lists down the sidebar using the FOREACH function. I’m presuming this will be by adding the_post_thumbnail, however I don’t know how to set it up correctly.

    i.e. foreach(array) { the_post_thumbnail; }

    Many thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter IntMilkBrilliant

    (@intmilkbrilliant)

    No takers…..?

    If you want to modify the output at all (for instance, by adding a thumbnail to each item), you’re not going to be able to use the wp_list_pages() function (well, you could, but it would be a lot more hassle than it’s worth).

    Instead, you should use the get_pages() function to retrieve an array of the pages you’re trying to list; then loop through those and output the appropriate HTML (with the thumbnail) for each one.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding thumbnails to php query’ is closed to new replies.