I have two pages created Home and About page.
I have set a featured image in my home page.
I want to get the image url of whatever featured image is set in my home page and display it on my about page (dynamic).
I am using my own custom template.
If possible I want to achieve it this way:
<img src="<?php get_homepage_featured_image_url(); //Something like this in wordpress. ?>"
CodePudding user response:
You have to use get_option to find the home page.
$home_id = get_option('page_on_front');
$home_thumb_id = get_post_thumbnail_id($home_id);
echo wp_get_attachment_image($home_thumb_id, 'large');