Answer the question
In order to leave comments, you need to log in
How to display a default gallery in a shortcode in WordPress?
Hello. There is a custom post type where images are added via the "gallery" field in the Custom Post Type UI.
The field name of the gallery is photo_ms I'm
using the standard WP gallery shortcode. The output is the following code:
<?php
$ids = get_field( get_the_ID(), 'photo_ms' );
if( $images ): ?>
<?php echo do_shortcode('[gallery columns="3" link="file" ids=" . $ids . "]'); ?>
<?php endif; ?>
But something is wrong with this code, since images are displayed not from the photo_ms field, that is, not from the post, but some left ones. But they are displayed ...
Tell me how to do everything in a smart way, if not difficult. Thank you.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question