Most Developers, designers and WordPress users use the native gallery shortcode to display their gallery.
You can also use the shortcode in a custom function like this:
add_action( 'loop_start', 'gallery_do_shortcode' );
function gallery_do_shortcode() {
echo do_shortcode('[gallery-shortcode-demo]');
}
The only problem is, shortcodes are not the most efficient way to execute a function or print your gallery as you can read more about here.
Another solution you can choose from if you want to display your gallery outside the content area is to use the gallery_shortcode
callback function in your child themes functions file like this:
Leave a Reply