Moving page featured image inside container and above title

Hi there,

Try this one:

add_action( 'wp', function() {
remove_action( 'generate_before_content', 'generate_featured_page_header_inside_single', 10 );
add_action( 'generate_before_main_content', 'generate_featured_page_header_inside_single' );
}, 55 );

If it still doesn’t work, another alternative is to use CSS, similar to what you’ve already implemented.

Hi Alvind,

I’ve just tried that code but it doesn’t do anything. 🙁

I digged some more in the support forum and found this code,

add_action('wp', function() {
remove_action( 'generate_after_header', 'generate_featured_page_header', 10 );
});

which does remove the featured images on pages, but what’s the action to add the image back on the page in a different position (inside the container, above the H1 title)?

Nevermind,

I kept tweaking with that code and ended up adding a function that works! Copying it here in case anyone wants to do the same,

add_action('wp', function() {
remove_action( 'generate_after_header', 'generate_featured_page_header', 10 );
add_action( 'generate_before_content', 'generate_featured_page_header' );
});

This doesn’t seem to break anything on my end so hopefully there are no hidden problems!

Thanks for any help 🙂

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer