How to get the gallery done via add_meta_box in Wordpress?

Good day to all!
Promuchavshis day and a half, I give up. The real question is this: there is a series of tutorials on custom meta_box in the WordPress, here it is the last part (pow), which creates a Metabox download individual images and galleries of images. In all previous lessons, as separate picture, I got all output in the template, but worked stood on the last paragraph -- the conclusion of the gallery.
At the end of the material is invited to bring pictures of the foreach loop:
foreach ( $gallery as $key => $value ) {
 $image_url = wp_get_attachment_url( $value );
 $background = ( isset( $image_url ) && " !== $image_url ) ? 'style="background:url(' . esc_url( $image_url ) . '); -webkit-background-size: cover; background-size: cover; background-repeat: no-repeat; ' . $bg_pos . '"' : ";

I understand that the question is simple, there's some basic thing I missed because of ignorance of PHP, but ask for help just because Google still has not helped. Images are loaded in the admin, that is all working, but how do I output this array -- I do not understand.

Many thanks for the help!
March 23rd 20 at 19:22
0 answer

Find more questions by tags WordPress