Title: PHP Call Parent Thumbnail
Last modified: August 21, 2016

---

# PHP Call Parent Thumbnail

 *  Resolved [JonWicks25](https://wordpress.org/support/users/jonwicks25/)
 * (@jonwicks25)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/php-call-parent-thumbnail/)
 * I’m currently working on my own theme, I only have it locally sadly.
 * Basically in the header I have a the navigation and then the featured image of
   the page, then a second navigation menu
 * ———- Nav ——–
    —– Feature Image —– ——– 2nd Nav ——–
 * I want only the parent pages to have featured images, and so the on a child page
   the feature image should be the same as it’s parent,
 * this is my code
 *     ```
       <?php
          if ( is_page('home')) {
            echo '<div style="float: left;">';
            echo riva_slider_pro( 1 );
            echo '</div>';
       } else if (is_page('our-clients' || 'our-services' || 'about' || 'our-team' || 'our-sectors' || 'information' || 'partners' || 'contact-us')) {
            echo '<div style="height: 170px;">';
            echo get_the_post_thumbnail($page->ID, 'full');
            echo '</div>';
       } else  {
            echo '<div style="height: 170px;">';
            echo get_the_post_thumbnail($post->post_parent, 'full');
            echo '</div>';
        }
       ?>
       ```
   
 * Individually each piece works fine, but all together I can’t get the child pages
   to pull the same featured image as the parent. Am I missing something simple?
 * Thanks

Viewing 1 replies (of 1 total)

 *  Thread Starter [JonWicks25](https://wordpress.org/support/users/jonwicks25/)
 * (@jonwicks25)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/php-call-parent-thumbnail/#post-3671447)
 * Never mind got it sorted. If anyone else is having similar problems this is the
   correct code I used
 *     ```
       <?php
       if ( is_page('home')) {
          echo '<div style="float: left;">';
          echo riva_slider_pro( 1 );
          echo '</div>';
       } else if (is_page('our-clients') || is_page('our-services') || is_page('our-team') || is_page('our-sectors') ||  is_page('information') || is_page('partners') || is_page('contact-us') || is_page('about')) {
          echo '<div style="height: 170px;">';
          echo get_the_post_thumbnail($page->ID, 'full');
          echo '</div>';
       } else  {
          echo '<div style="height: 170px;">';
          echo get_the_post_thumbnail($post->post_parent, 'full');
          echo '</div>';
       }
       ?>
       ```
   
 * I had the coding for else if (is_page(‘page’) || wrong

Viewing 1 replies (of 1 total)

The topic ‘PHP Call Parent Thumbnail’ is closed to new replies.

## Tags

 * [child](https://wordpress.org/support/topic-tag/child/)
 * [feature image](https://wordpress.org/support/topic-tag/feature-image/)
 * [parent](https://wordpress.org/support/topic-tag/parent/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [thumbnail](https://wordpress.org/support/topic-tag/thumbnail/)

 * 1 reply
 * 1 participant
 * Last reply from: [JonWicks25](https://wordpress.org/support/users/jonwicks25/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/php-call-parent-thumbnail/#post-3671447)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
