get ID of the page that is set as “home”
-
I use a script that extracts header images from the files attached to a post or page.
Now, if none is set, I want to use the one from the front page.
Not hard-coded in the functions.php.This is my header-image-extraction-function:
function postheader() { if ( $images = get_children(array( 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'numberposts' => '-1', 'order' => 'DESC', 'orderby' => 'ID', 'post_mime_type' => 'image',))) { foreach( $images as $image ) { $attachmenturl=wp_get_attachment_url($image->ID); $attachmentimage=wp_get_attachment_image($image->ID, 'full' ); $img_title = $image->post_title; if (stristr($img_title, '[header]')){ echo "<img src=$attachmenturl width=630 height=112>"; } } } else { echo "No Image"; } }
Instead of the “no image” bit, I want the same function to go through the home page, not the current id.
Any Ideas?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘get ID of the page that is set as “home”’ is closed to new replies.