Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › get thumbs from serialied array › Reply To: get thumbs from serialied array
July 9, 2020 at 3:01 pm
#28351
Keymaster
That is strange. Maybe this variation:
add_filter( 'asp_results', 'asp_custom_image_results', 10, 1 );
function asp_custom_image_results( $results ) {
$field_name = 'field_name';
// Parse through each result item
foreach ($results as $k=>&$r) {
if ( $r->content_type == 'pagepost' && empty($r->image) ) {
$field = get_post_meta( $r->id, $field_name , true );
$field = maybe_unserialize($field);
if ( isset($field[0], $field[0][0]) )
$r->image = $field[0][0];
}
}
return $results;
}