Skip to content

Snippet: Display Thumbnail Above Title For Pages

// Display post thumbnail above the title on pages
function my_add_thumbnail_to_pages() {

    // For pages only
    if ( ! is_page() ) {
        return;
    } ?>

    <div class="my-page-header container clr">
         'full',
            'alt'   => wpex_get_esc_title(),
        ) ); ?>
    </div>

<?php }
add_action( 'wpex_hook_page_header_before', 'my_add_thumbnail_to_pages' );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top