Hi there,
For the background image, we can do this:
add_filter( 'generate_page_hero_background_image_url', function( $url ) {
$background_image = get_post_meta( get_the_ID(), 'your_custom_field', true );
if ( $background_image ) {
$url = $background_image;
}
return $url;
} );
As for the title, I’m assuming you mean the {{post_title}}
field?
If so, you can do this:
add_filter( 'generate_page_hero_post_title', function( $title ) {
$custom_title = get_post_meta( get_the_ID(), 'your_custom_field', true );
if ( $custom_title ) {
$title = $custom_title;
}
return $title;
} );
Adding PHP: https://docs.generatepress.com/article/adding-php/