$value) {
if($value == $name)
$found = $index;
}
$place = $found + 1;
return $arrVals[$place];
}
/* return thumbnail url and image find url for first image of a given post */
function get_comment_thumb_full ( $post_id ) {
$images = get_attached_media('image', $post_id);
$thumbsrc = '';
$fullsrc = '';
foreach($images as $image) {
# $thumbsrc = wp_get_attachment_image_src($image->ID,'optics-mws-gallery-thumb')[0];
$thumbsrc = wp_get_attachment_image_src($image->ID,'thumbnail')[0];
$fullsrc = wp_get_attachment_image_src($image->ID,'full')[0];
break;
}
return [$thumbsrc, $fullsrc];
}
$page = get_query_var('comments');
$offset = (intval($page) * $limit) - $limit;
if ( $offset < 0 ) {
$offset = 0;
}
$param = array( 'status' => 'approve',
'offset' => $offset,
'number' => $limit );
$total_comments = get_comments( array( 'status' => 'approve' ) );
$pages = ceil( count( $total_comments ) / $limit );
$comments = get_comments( $param );
get_header(); ?>