I would like to be able to allow the user of this twentytwelve child theme to be upload a featured image to a page (not post) and have that dynamically become the background image (positioned basically the way it is now-see thesite.com)
I think it would need a dynamic url (like wp_get_attachment_thumb_url ), though I’m not using a loop. (was thinking that function has to be used inside a loop.
I am using the code below as a template part. This is what is generating the content on the front page. So basically, I need to get this featured image and use it as a background image for a templage part, and not inside a loop.
<?php $page = get_page_by_title ( 'Welcome' ); ?> <div id="welcome-intro" class="clear"> <?php if ( get_the_post_thumbnail ( $page->ID ) ) : ?> <figure class="entry-page-image"> <?php echo get_the_post_thumbnail ( $page->ID, 'full'); ?> </figure> <?php endif; ?> <article id="intro-elements"> <div class="welcome-entry-content"> <?php echo apply_filters( 'the_content', $page->post_content); ?> </div> </article> </div>
- The topic ‘dynamic background image for template part’ is closed to new replies.