Hot answers tagged


For unattached images, the post_parent column in the wp_posts table, has the value of 0. Your gallery shortcode in that case is: [gallery id="0" columns="4"] which means you are calling get_children() with post_parent as 0. You can e.g. use the gallery shortcode callback gallery_shortcode() directly: if( $parent_id = $post->post_parent ) { echo ...

Only top voted, non community-wiki answers of a minimum length are eligible