• I just upgraded the theme to the latest version 0.3.5 and I have a problem in the front page.

    The block widgets disappeared and I get the following error:

    Fatal error: Call to undefined function optimizer_attachment_id_by_url() in /web/htdocs/www.rosaliagreco.com/home/wp-content/themes/optimizer/framework/core-functions.php on line 194

    Please someone help!

Viewing 1 replies (of 1 total)
  • Theme Author OptimizerWP

    (@layerthemes)

    @

    Looks like a bug. Can you please go to Appearance >Editor and select core-functions.php and add this to the very bottom of the file:

    //**Return an ID of an attachment by searching the database with the file URL (Inexpensive query)**//
    function optimizer_attachment_id_by_url( $url ) {
    	$parsed_url  = explode( parse_url( WP_CONTENT_URL, PHP_URL_PATH ), $url );
    
    	$this_host = str_ireplace( 'www.', '', parse_url( home_url(), PHP_URL_HOST ) );
    	$file_host = str_ireplace( 'www.', '', parse_url( $url, PHP_URL_HOST ) );
    
    	if ( ! isset( $parsed_url[1] ) || empty( $parsed_url[1] ) || ( $this_host != $file_host ) ) {
    		return;
    	}
    
    	global $wpdb;
    	$attachment = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->prefix}posts WHERE guid RLIKE %s;", $parsed_url[1] ) );
    	return $attachment[0];
    }

    Regards

Viewing 1 replies (of 1 total)
  • The topic ‘Front page widgets error following update’ is closed to new replies.