Home Forums WoodMart support forum Error log filling with lazyload errors

Error log filling with lazyload errors

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #113168

    Bulld Digital
    Participant

    Hi,

    My error log is filling up with this error/notice:

    Notice: Trying to get property of non-object in /home/globa781/public_html/wp-content/themes/woodmart/inc/modules/lazy-loading.php on line 193

    #113185

    Artem Temos
    Keymaster

    Hi,

    Try to add the following PHP code snippet to the child theme functions.php file to fix this

    function woodmart_lazy_attributes($attr, $attachment, $size) {
    
    		$attr['data-wood-src'] = $attr['src'];
    		if( isset( $attr['srcset'] ) ) $attr['data-srcset'] = $attr['srcset'];
    		
    		if ( is_object( $attachment ) ) {
    			$attr['src'] = woodmart_get_attachment_placeholder( $attachment->ID, $size );
    		}
    		
    		$attr['srcset'] = '';
    
    		$attr['class'] = $attr['class'] . ' ' . woodmart_lazy_css_class();
    
    		return $attr;
    	}

    Regards

    #113522

    Bulld Digital
    Participant

    Solved, thanks!

    #113528

    Artem Temos
    Keymaster

    Great, you are welcome.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Error log filling with lazyload errors’ is closed to new replies.