Using Parents Page Thumbnail URL
-
I’m using this code to grab the url of the thumbnail to insert it as a background image.
<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?> <div class='divName' style='background-image: url(<?php echo $thumb['0']; ?>);'>
How do I add to this code to work like his:
If parent > insert thumbnail URL.
If child of parent has NO thumbnail > insert parent thumbnail URL.
If child of parent has thumbnail > insert thumbnail URL.I’m sorta new to WP so I’m not sure how to go about doing this.
- The topic ‘Using Parents Page Thumbnail URL’ is closed to new replies.