Support » Theme: Lovecraft » Small notice thrown in some scenarios

  • A small notice is thrown sometimes by the file header.php in some scenarios.

    For example, when trying to create a child theme with Child Theme Configurator, I get a notice like this:

    Notice: Trying to get property of non-object in /home/xxxxx/public_html/wp-content/themes/lovecraft/header.php on line 143

    The lines from 141-143 show the next:
    $header_image = get_header_image();
    $header_image_data = get_theme_mod( 'header_image_data' );
    $header_image_alt = get_post_meta( $header_image_data->attachment_id, '_wp_attachment_image_alt', true );

    What makes me then think that sometimes get_theme_mod does not get all the information it needs.

    While this does not breaks anything, I noticed this while creating a child theme for this theme. So may make some people wonder.

    Thanks for reading.

    • This topic was modified 3 years, 2 months ago by Kadai Crosshansen. Reason: added some code tags
Viewing 1 replies (of 1 total)
  • I’m seeing the same error when I view a site in Customizer, but when I save my changes and close Customizer the error message disappears.

    When I check line 143 of the header.php, here’s what I see:

    $header_image_alt = get_post_meta( $header_image_data->attachment_id, '_wp_attachment_image_alt', true );

Viewing 1 replies (of 1 total)
  • The topic ‘Small notice thrown in some scenarios’ is closed to new replies.