You should be able to rewrite what you have about and also use get_permalink
as @Benoti stated while omitting the $split
array.
get_permalink
accepts either the Post ID or a post object.
global $rental;
$images = get_children( array(
'post_parent' => $rental_id,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order ID'
) );
$array = $images;
$number_of_elements = 3;
$count = count( $array );
for ( $i = 0; $i <= $count - 1; $i++ ) {
$slices = array_slice( $array, $i , $number_of_elements);
if ( count( $slices ) != $number_of_elements )
break;
echo "<div class="Outer Top">";
foreach( $slices as $inneritem ) {
$link = wp_get_attachment_url( $inneritem->ID );
echo "<div class="Inner Top">";
echo "<img src="https://wordpress.stackexchange.com/questions/251866/$link">";
echo "</div>";
}
echo "</div>";
}