posts – Notice: Undefined index: h in themes/dentario/fw/core/core.wp.php on line 1515
I am getting this error on this theme and I am trying to find out if the website even needs this set of code. It is a theme that doesn’t seem to have support. I contacted the support team and they acted like it was a different website all together, so I am trying to take the lead from here and see where I need to make changes to keep the theme up to date with professional standards. This is the error I am getting.
Notice: Undefined index: h in themes/dentario/fw/core/core.wp.php on line 1515
However, when I go to this file, it is fairly long, below is the code that is on this line, before and after.
// Extract gallery, video and audio from full post content
if (is_array($cached_post)) {
$post_attachment = $cached_post['post_attachment'];
} else {
$post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id));
}
$post_thumb = $post_thumb_url = $post_gallery = $post_video = $post_video_image = $post_audio = $post_audio_image = $post_url = $post_url_target="";
if (dentario_substr($opt['layout'], 0, 6)=='single')
$post_thumb = dentario_get_resized_image_tag($post_id, $thumb_sizes['w'], $thumb_sizes['h'], null, false, false, true);
else if (dentario_substr($opt['layout'], 0, 10)=='attachment')
$post_thumb = dentario_get_resized_image_tag($post_attachment, $thumb_sizes['w'], $thumb_sizes['h'], null, false, false, true);
else
$post_thumb = dentario_get_resized_image_tag($post_id, $thumb_sizes['w'], $post_type=='product' && dentario_get_theme_option('crop_product_thumb')=='no' ? null : $thumb_sizes['h']);
$post_thumb_url = dentario_get_tag_attrib($post_thumb, '<img>', 'src');
if ($post_format == 'gallery') {
$post_gallery = dentario_build_gallery_tag(dentario_get_post_gallery($post_content_plain, $post_id, max(2, dentario_get_custom_option('gallery_max_slides'))), $thumb_sizes['w'], $thumb_sizes['h_crop'], false, $post_link);
} else if ($post_format == 'video') {
$src="";
$post_video = dentario_get_post_video($post_content_original, false);
if ($post_video=='') {
$src = dentario_get_post_video($post_content_original, true);
} else {
if (dentario_substr($post_video, 0, 1)=='[') {
$src = dentario_get_tag_attrib($post_video, '[trx_video]', 'src');
if (empty($src)) $src = dentario_get_tag_attrib($post_video, '[trx_video]', 'url');
if (empty($src)) $src = dentario_get_post_video($post_video, true);
$post_video_image = dentario_get_tag_attrib($post_video, '[trx_video]', 'image');
if ($post_video_image > 0) {
$attach = wp_get_attachment_image_src( $post_video_image, 'full' );
if (isset($attach[0]) && $attach[0]!='')
$post_video_image = $attach[0];
}
if (!is_singular() || dentario_storage_get('blog_streampage')) {
if (empty($post_video_image))
$post_video_image = $post_thumb;
if (empty($post_video_image))
$post_video_image = dentario_get_video_cover_image($src);
}
if (!empty($post_video_image))
$post_video_image = dentario_get_resized_image_tag($post_video_image, $thumb_sizes['w'], $thumb_sizes['h']);
} else
$src = dentario_get_post_video($post_video, true);
}
if ($src) {
$src = dentario_get_video_player_url($src, $post_thumb!='' || $post_video_image!='');
$post_video = '<video src="'.esc_url($src).'" width="'.esc_attr($thumb_sizes['w']).'" height="'.round($thumb_sizes['w']/16*9).'"></video>';
}
if ($post_video!='' && $opt['substitute_video']) {
$post_video = dentario_substitute_video($post_video, $thumb_sizes['w'], round($thumb_sizes['w']/16*9), false);
}
} else if ($post_format == 'audio') {
$src = $data="";
$post_audio = dentario_get_post_audio($post_content_original, false);
if ($post_audio=='') {
$src = dentario_get_post_audio($post_content_original, true);
} else {
if (dentario_substr($post_audio, 0, 1)=='[') {
$src = dentario_get_tag_attrib($post_audio, '[trx_audio]', 'src');
if (empty($src)) $src = dentario_get_tag_attrib($post_audio, '[trx_audio]', 'url');
if (empty($src)) $src = dentario_get_post_audio($post_audio, true);
$post_audio_image = dentario_get_tag_attrib($post_audio, '[trx_audio]', 'image');
if ($post_audio_image > 0) {
$attach = wp_get_attachment_image_src( $post_audio_image, 'full' );
if (isset($attach[0]) && $attach[0]!='')
$post_audio_image = $attach[0];
}
if (empty($post_audio_image))
$post_audio_image = $post_thumb;
if ($post_audio_image)
$post_audio_image = dentario_get_resized_image_url($post_audio_image, $thumb_sizes['w'], $thumb_sizes['h']);
$post_audio_title = dentario_get_tag_attrib($post_audio, '[trx_audio]', 'title');
$post_audio_author = dentario_get_tag_attrib($post_audio, '[trx_audio]', 'author');
$data = ($post_audio_title != '' ? ' data-title="'.esc_attr($post_audio_title).'"' : '')
.($post_audio_author != '' ? ' data-author="'.esc_attr($post_audio_author).'"' : '')
.($post_audio_image != '' ? ' data-image="'.esc_attr($post_audio_image).'"' : '');
} else
$src = dentario_get_post_audio($post_audio, true);
}
if ($src) {
$post_audio = '<audio class="sc_audio" src="'.esc_url($src).'"'
. ($data)
. '></audio>';
}
if ($post_audio!='' && $opt['substitute_audio']) {
$post_audio = dentario_substitute_audio($post_audio, false);
}
}
if ($post_format == 'image' && !$post_thumb && !is_single()) {
if (($src = dentario_get_post_image($post_content_original, $post_id))!='')
$post_thumb = dentario_get_resized_image_tag($src, $thumb_sizes['w'], $thumb_sizes['h_crop']);
}
if ($post_format == 'link') {
$post_url_data = dentario_get_post_link($post_content_original, false);
$post_url_target = $post_url_data['target'];
}
I guess part of my question is, do even need this code above? I am trying to make the theme lighter, and it seems like a lot of code was put in this theme to cater to everyone. I would like to focus it more on the one business I am working with. Any way I can remove this error? and do I even need this chunk of code above?
Leave an answer