M
M
Mark Zagrtdinov2019-01-31 16:27:42
Slider
Mark Zagrtdinov, 2019-01-31 16:27:42

Gallery output in Carbon Fields?

I can not figure out how to display the gallery in the template

<?php
use Carbon_Fields\Container;
use Carbon_Fields\Field;

Container::make( 'theme_options', __( 'Мой Сайт' ) )
   ->add_tab( __( 'Главная' ), array(
   Field::make( 'media_gallery', 'crb_media_gallery', __( 'Слайдер' ) ),
  ) )
?>

Documentation:
https://docs.carbonfields.net/#/fields/media-gallery
In what direction should we move in order to understand the principle of displaying a gallery in a template?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
devjunjs, 2019-04-18
@devjunjs

<?php $slides = carbon_get_post_meta(get_the_ID(), 'crb_media_gallery');
     foreach ($slides as $slide):
?>
      <img src="<?php echo wp_get_attachment_image_url($slide); ?>" alt="Image">
<?php endforeach; ?>

Link to Function

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question