Hi:

I've been banging my head over this all day...
I'm attempting to create my first WordPress theme and have hit a wall trying to work with the "the_post_thumbnail()" function.

In my theme, I'm using panels to navigate the site (rather than a top menu) and have them setup so when I create a new page a new panel automatically gets created. I have this working fine, however, now I'm attempting to have the Feature Image of each page be displayed as a thumbnail for each panel. This is where I'm banging my head...

This snippet below automatically creates a panel with the Page name inside the panel for each page in my WordPress site. As mentioned, it works perfectly.

<ul>
    <li>
        <div>
            <?php wp_list_pages('&title_li=&link_before=<span>&link_after=</span>'); ?>
        </div>
    </li>
</ul>

What I've been trying to do today is to add some form of"the_post_thumbnail()"into the wp_list_pages string so that when a panel and title are automatically generated, so is the Feature image associated with that page.

Sound easy?
I thought so at the start of today :(

I would really appreaciate any help on this.

Best Regards,
Dennis Hall

You may refer https://wordpress.org/support/topic/thumbnail-as-menu-item-1 for custom walker and parse in as argument in wp_list_pages($args)

But be warn that the wp_list_pages will list all pages, what I suggest is using wp_nav_menu() to allow user customize their own nav bar content.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.