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)
Viewing 1 replies (of 1 total)
- The topic ‘PHP Call Parent Thumbnail’ is closed to new replies.