February 18, 2016 at 02:54
#104505
Participant
I fix that.
kleo-framework/lib/function-core.php
COPY CODE
function kleo_get_post_thumbnail_url( $post_id = null ) {
$image_url = '';
$thumb = get_post_thumbnail_id( $post_id );
//all good. we have a featured image
$featured_image_url = wp_get_attachment_url( $thumb );
if ( $featured_image_url ) {
$image_url = $featured_image_url;
} elseif ( sq_option( 'blog_get_image', 1 ) == 1 ) {
global $post;
if (! is_object($post) && $post_id != NULL ) {
$post = setup_postdata( get_post($post_id) );
}
ob_start();
ob_end_clean();
if (isset($post->post_content)) {
$output = preg_match_all('|<img.*?src=[\'"](.*?)[\'"].*?>|i', $post->post_content, $matches);
$image_url = isset($matches[1][0]) ? $matches[1][0] : null;
}
}
//Defines a default image
if ( empty( $image_url ) && get_post_type() == 'post' ) { //** NEW Filter the post_type to 'post'
$image_url = sq_option_url('blog_default_image', '');
}
return $image_url;
}
lib/theme-functions.php // function kleo_ajax_search() – Line 647
Line 770-785
COPY CODE
$format = get_post_format( $post->ID );
if ( $img_url = kleo_get_post_thumbnail_url( $post->ID ) ) {
$image = aq_resize( $img_url, 44, 44, true, true, true );
if( ! $image ) {
$image = $img_url;
}
$image = '<img src="'. $image .'" class="kleo-rounded">';
} else {
if ($format == 'video') {
$image = "<i class='icon icon-video'></i>";
} elseif ($format == 'image' || $format == 'gallery') {
$image = "<i class='icon icon-picture'></i>";
} else {
$image = "<i class='icon icon-link'></i>";
}
}
becomes
COPY CODE
$format = get_post_format( $post->ID );
if ( $img_url = kleo_get_post_thumbnail_url( $post->ID ) ) {
$image = aq_resize( $img_url, 44, 44, true, true, true );
// if( ! $image ) {
// $image = $img_url;
// }
$image = '<img src="'. $image .'" class="kleo-rounded">';
} else {
if ($format == 'video') {
$image = "<i class='icon icon-video'></i>";
} elseif ($format == 'image' || $format == 'gallery') {
$image = "<i class='icon icon-picture'></i>";
} else {
if (get_post_type( $post->ID ) == 'post') { //** NEW - Post_type filter
$image = '<img src="'. sq_option_url('blog_default_image', '') .'" class="kleo-rounded ajax_search_image">'; //** NEW - Providing default image url + .ajax_search_image css class
}
else {
$image = "<i class='icon icon-link'></i>";
}
}
}
Results on screenshots