• You can find this code below inside “content-gallery.php” (twentyeleven theme)

    <?php
    $images = get_children( array(  'post_parent' => $post->ID,
    				'post_type' => 'attachment',
    				'post_mime_type' => 'image',
    				'orderby' => 'menu_order',
    				'order' => 'ASC',
    				'numberposts' => 999 ) );
    
    if ( $images ) :
    	$total_images = count( $images );
    	$image = array_shift( $images );
    	$image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
    ?>

    The problem here is:
    1. When a post is a gallery post, that post will show a gallery of images.

    The question is: How do i display an image inside that gallery?
    The answer is very ugly: You upload your image by using the media button when you’re editing your post. That way, that image will be a child of that post. UGLY!!!

    Why? Because this is a one-to-one relationship which means you can only use that image for ONE GALLERY ONLY! What do i need to do to use that image for another gallery? You upload another copy of that image.

    WordPress, please fix this one-to-one relationship. It’s ugly

Viewing 3 replies - 1 through 3 (of 3 total)
  • It was fixed – in WordPress 3.5. You can now create your own custom galleries.
    https://managewp.com/wordpress-3-5-closer-look

    Thread Starter joymanur

    (@joymanur)

    Esmi, thank you for your response. But i’m very sure that WordPress hasn’t fixed it yet (fully fix).

    I don’t know if i’m asking to0 much but i believe WordPress should set every “post_parent” value to “0” for every image attachment, so people will stop displaying this old gallery.

    I really don’t what to do (other than hacks) when my clients are asking me to display one image on more than one gallery. @_@

    my clients are asking me to display one image on more than one gallery

    And you can do this with the new media handling.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress, when will you fix this one-to-one relationship? It's ugly n I hate it’ is closed to new replies.