Native gallery custom html output

I’ve added image gallery to my page via Add Media > Create Gallery. I don’t want to output default html of the gallery, neither are sufficient options to change gallery sortcode’s attributes: itemtag, icontag, captiontag as I want an entirely custom html.

I’ve tried to filter post_gallery, grab urls of images that are included as a gallery into that page and output them:

add_filter( ‘post_gallery’, ‘my_name_page_gallery’, 10, 2 );
function my_name_page_gallery($output, $attr) {
$output = get_post_gallery_images();
return $output;
}

But I get the following error:

Maximum function nesting level of ‘512′ reached, aborting! in
/wp-includes/shortcodes.php on line 234

What am I doing wrong? How do I get gallery images’ urls and output custom html?

Read more here:: Native gallery custom html output

Leave a Reply

Your email address will not be published. Required fields are marked *