3 added 1119 characters in body
source | link

I'm trying to show a post thumbnail outside of the loop. The reason for this is that i want the featured image to show inside a custom page template, which will set the header image for the particular page for which the custom page template is set.

I've tried the obvious the_post_thumbnail(); and as expected, it didn't work. What's the best solution for using the featured image outside of the loop?

 

The custom page template code i'm working with...

<div id="primary" class="content-area">
    <div id="content" class="site-content" role="main">

    <div class="home-header-image">

    <?php IMAGE WILL GO HERE ?> 

    </div>

    <div class="top_items_container">
        <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Home Top Content')) :

endif; ?>
    </div><!-- .top_items_container -->

                <div class="entry-content">
                    <?php the_content(); ?>
                    <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
                </div><!-- .entry-content -->

                <footer class="entry-meta">
                    <?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
                </footer><!-- .entry-meta -->
            </article><!-- #post -->

            <?php comments_template(); ?>

    </div><!-- #content -->
</div><!-- #primary -->

I'm trying to show a post thumbnail outside of the loop. The reason for this is that i want the featured image to show inside a custom page template, which will set the header image for the particular page for which the custom page template is set.

I've tried the obvious the_post_thumbnail(); and as expected, it didn't work. What's the best solution for using the featured image outside of the loop?

 

I'm trying to show a post thumbnail outside of the loop. The reason for this is that i want the featured image to show inside a custom page template, which will set the header image for the particular page for which the custom page template is set.

I've tried the obvious the_post_thumbnail(); and as expected, it didn't work. What's the best solution for using the featured image outside of the loop?

The custom page template code i'm working with...

<div id="primary" class="content-area">
    <div id="content" class="site-content" role="main">

    <div class="home-header-image">

    <?php IMAGE WILL GO HERE ?> 

    </div>

    <div class="top_items_container">
        <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Home Top Content')) :

endif; ?>
    </div><!-- .top_items_container -->

                <div class="entry-content">
                    <?php the_content(); ?>
                    <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
                </div><!-- .entry-content -->

                <footer class="entry-meta">
                    <?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
                </footer><!-- .entry-meta -->
            </article><!-- #post -->

            <?php comments_template(); ?>

    </div><!-- #content -->
</div><!-- #primary -->
2 edited tags
| link
1
source | link

Post thumbnail outside of loop

I'm trying to show a post thumbnail outside of the loop. The reason for this is that i want the featured image to show inside a custom page template, which will set the header image for the particular page for which the custom page template is set.

I've tried the obvious the_post_thumbnail(); and as expected, it didn't work. What's the best solution for using the featured image outside of the loop?