This snippet is from the same book project as this snippet that gets the title of the parent page. It allows us to show the same header image on all subsequent chapters of a book (child pages)>
srcset for the responsive
The beauty of this snippet is that it uses WordPress’ built in responsive image support, introduced in WordPress 4.4. This allows a browser to use the best sized image available using the
srcset attribute, potentially saving bandwidth and speeding up page load times in the process.
Put it in a template file
This code is meant to be placed anywhere in a template file that you’d need to display the Featured Image of a parent page.