Try to remove this fragments (all) from your News/gavern/widgets.nsp.php
- Code: Select all
if(is_multisite()) {
restore_current_blog();
}
Then replace function generate_art_image with this one
- Code: Select all
function generate_art_image($i) {
$art_ID = '';
if($this->wdgt_config['data_source_type'] == 'custom') {
$art_ID = $this->wdgt_results[0][$i]->ID;
} else {
$art_ID = $this->wdgt_results[$i]->ID;
}
$art_url = get_permalink($art_ID);
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $art_ID ), 'single-post-thumbnail' );
$image_path = $image[0];
$upload_dir = wp_upload_dir();
$image_path = str_replace($upload_dir['baseurl'] . '/', '', $image_path);
if($image_path != '') {
$img_editor = wp_get_image_editor( $upload_dir['basedir'] . '/' . $image_path);
if(!is_wp_error($img_editor)) {
$img_editor->resize($this->wdgt_config['article_image_w'], $this->wdgt_config['article_image_h'], true);
$img_filename = $img_editor->generate_filename( $this->id, dirname(__FILE__) . '/' . 'cache_nsp');
$img_editor->save($img_filename);
$new_path = basename($img_filename);
restore_current_blog();
$cache_uri = get_stylesheet_directory_uri() . '/gavern/cache_nsp/';
if(is_multisite() && $this->wdgt_config['data_source_blog'] != '' && is_numeric($this->wdgt_config['data_source_blog'])) {
switch_to_blog($this->wdgt_config['data_source_blog']);
}
if(is_string($new_path)) {
$new_path = $cache_uri . $new_path;
$style = '';
if($this->wdgt_config['image_block_padding'] != '' && $this->wdgt_config['image_block_padding'] != '0') {
$style = ' style="margin: '.$this->wdgt_config['image_block_padding'].';"';
}
if($this->wdgt_config['article_image_pos'] == 'left' && $this->wdgt_config['article_image_order'] == 1) {
return apply_filters('gk_nsp_art_image', '<div class="gk-nsp-image-wrap"><a href="'.$art_url.'" class="gk-image-link"><img src="'.$new_path.'" alt="" class="gk-nsp-image" '.$style.' /></a></div>');
} else {
return apply_filters('gk_nsp_art_image', '<a href="'.$art_url.'" class="gk-responsive gk-image-link"><img src="'.$new_path.'" alt="" class="gk-nsp-image gk-responsive" '.$style.' /></a>');
}
} else {
return __('An error occured during creating the thumbnail.', GKTPLNAME);
}
} else {
return __('An error occured during creating the thumbnail.', GKTPLNAME);
}
} else {
return '';
}
}
Do a backup first.. and let me know if everything is ok.