adding featured image as background for echo-ed div?
-
working with a theme that has this for it’s loop:
$home_pages = get_pages ( $args ) ; if ( !empty ( $home_pages ) ) { foreach ( $home_pages as $home_page ) { $post = get_post ( $home_page->ID ); setup_postdata ( $post ); $page_template = get_post_meta( $id, '_wp_page_template', true ); echo "<div class='page-wrapper'>"; if ( $page_template != "default" && $page_template != "") include ( THEME_ROOT . '/content-' . $page_template ); else include ( THEME_ROOT . '/content-page.php'); wp_reset_postdata(); echo "</div>"; } }
I want the pages that have a featured image to use that featured image as the background for the page-wrapper class. Is there an easy way to do this? Can I add in an if statement that checks for the featured image and if it has it, it echoes the div class page wrapper with an inline style calling the featured image, if not it just calls the regular div class??
Thanks a million in advance.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘adding featured image as background for echo-ed div?’ is closed to new replies.