wordpress-bootstrap
wordpress-bootstrap copied to clipboard
new picture galleries won't show up after updating to WP 3.5.1
I'm running wp 3.5.1 with wp-bootstrap aa52837703109126d2a456b0ce8abe7d75476589 from git.
When I create new image galleries, they won't show up on the page, as in no markup at all. The rest of the post works fine. Galleries I've created before work fine. I tried switching to original wp-bootstrap from my child theme, where I encounter the same issue. Switching to twentyeleven works fine.
When I check post contents using phpmyadmin, both working and non working galleries have the correct gallery shortcode
Update, I found out the problem lies in the way wordpress-bootstrap retrieves pictures. You can add pictures that you upload as an attachment to your current post, but you can't add pictures you added to another post or no post at all, because post_parent is matched against the current post ID in the gallery shortcode
A possible fix would be
function gallery_shortcode_tbs($attr) {
global $post, $wp_locale;
$output = "";
$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID );
// 3.5 Gallery Fix
if ( !empty( $attr['ids']) ) {
// 'ids' is explicitly ordered, unless you specify otherwise.
if ( empty( $attr['orderby'] ) )
$args['orderby'] = 'post__in';
$args['include'] = $attr['ids'];
// these may not not have current post set as parent
unset($args['post_parent']);
}
$attachments = get_posts($args);
...
I had this problem too. Thanks for the fix.
Great fix!! Thanks =)
Same problem here. I can't fix it! Please help :)