0

I am getting a notice from the reviewer:

Make sure that your template doesn’t raise any PHP errors, notices or warnings on activation. Enabling wp_debug and using the Debug Bar plugin can help you with this: http://envato.d.pr/NZi4sd/4IBsYXn1

Below is the code for that part:

function touche_inline_styles() {

    // Blog header
    global $post;
    $header_image = '';

    if ( has_post_thumbnail( $post->ID ) ) { // <!-- This is line 92
        $header_image = get_the_post_thumbnail_url( $post->ID, 'full' );
    } elseif ( get_header_image() ) {
        $header_image = get_header_image();
    }

    if ( $header_image ) {
        $header_image_css = "
                .blog__header {
                        background-image: url({$header_image});
                }";
        wp_add_inline_style( 'theme-styles', $header_image_css );
    }
}

add_action( 'wp_enqueue_scripts', 'touche_inline_styles' );

The problem is no matter what I do I cannot see this notice. Is it possilble to understand the issue from the code above? Thanks in advance!

  • 1
    may be you can only see this notice on an URL without $post. this can be the home page or a taxonomy page – mmm Jul 12 '17 at 17:17
  • @mmm, right you are! I tried to open a 404 and got this notice. Thanks! – Deka87 Jul 12 '17 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.