• Resolved paroxp

    (@paroxp)


    Hello everyone!

    I’ve just came across new RC3 version of WordPress, and tried to import images to the post as simple attachment.

    Not sure if that’s by the design or just a bug, there doesn’t seem any option to do so…
    I don’t want to insert images into post, but than, call them using Theme as in the Documentation.

    Documentation

    <ul>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post();    
    
     $args = array(
       'post_type' => 'attachment',
       'numberposts' => -1,
       'post_status' => null,
       'post_parent' => $post->ID
      );
    
      $attachments = get_posts( $args );
         if ( $attachments ) {
            foreach ( $attachments as $attachment ) {
               echo '<li>';
               echo wp_get_attachment_image( $attachment->ID, 'full' );
               echo '<p>';
               echo apply_filters( 'the_title', $attachment->post_title );
               echo '</p></li>';
              }
         }
    
     endwhile; endif; ?>
    </ul>

    And so far, it displays all posible attachments added at any time…

    Just wonder if there is or will be an option to select the attachments for specific post or if this functionality is now all over?

    Need to know how should I develop some functionality for the client.

    Thanks for any info.
    Rafal.

Viewing 7 replies - 1 through 7 (of 7 total)
  • This is a big issue for me too.

    My theme does not use inline images or any gallery shortcodes – the theme function pulls the image attachments directly into a slider, with code like Rafal’s above.

    I’m using Faster Image Insert plugin for media handling.

    Advice requested…. ??

    Moderators –

    To be clear this issue is about whether, in 3.5RC3, images can still be attached to a post (i.e. as child posts) WITHOUT being automatically inserted into the post, or into a gallery.

    To be clear this issue is about whether, in 3.5RC3, images can still be attached to a post (i.e. as child posts) WITHOUT being automatically inserted into the post, or into a gallery.

    Yes. When images are uploaded via the media dialog, they automatically become attachments of that post. This is the same behavior as 3.4.

    Thanks Andrew –
    But no, I’m not so sure the same behavior is happening – I think my word choice has been unclear. The question is not whether images uploaded to a post get attached, but whether images may be attached to the post via the media uploader, without being incorporated into the content of the post and thereby displayed by default functions.

    Rafal and I don’t want the attached images automatically displayed in the post – our functions.php is retrieving attachments separately and displaying them in some special way. We only want them attached in the database.

    In 3.4, you could upload the images and, as you said, they would automatically become attachments (child posts). You could choose whether to display them in the post inline, display them via a gallery, or not display them in the post at all. The “not at all” option, keeping their status as attachments/children, is the one used by my theme, and seemingly Rafal’s too.

    Functionally, I don’t want any automatic process displaying those attachments in the post, because my functions.php handles it.

    3.5 seems to give you the choice of inline inclusion or gallery inclusion – or else it simply won’t attach the images as post-children/attachments.

    Have I got this wrong? (very possible :))

    Try this:

    • On a post or page, click the (new) Add Media button.
    • Upload an image or other file.
    • If you look at your MySQL database, you will indeed see that the image gets attached to the post or page. Attachments originally get menu_order=0. If you drag-and-drop to reorder the attachments, all attachments get a new menu_order starting at 1. (The reordering functionality is only available when “Images uploaded to this Post” is selected in the drop-down.)
    • Exit the modal dialog by clicking in the dark grey border or in the dialog’s upper-right X button.

    That should upload an attached image, without any insertion or gallery, just like in 3.4. I am very glad this all works as of rc3; as with your functions.php, my AutoNav plugin uses this too.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    In 3.4, you could upload the images and, as you said, they would automatically become attachments (child posts). You could choose whether to display them in the post inline, display them via a gallery, or not display them in the post at all.

    I’m trying to reproduce this…

    Opened 3.5. Made a new post. Uploaded an image. Closed without inserting image, put in a gallery, or made features.

    Went to Media and the image is attached to the post.

    Am I missing something here or isn’t this exactly like it was?

    I have to say I am having the same issue as paroxp. I have always used a fallback function for displaying a thumbnail if there was no featured image set (very similar to paroxp’s code above).

    I did upgrade a local version to 3.5 and the same function still works on existing posts. However, on a fresh install of 3.5, it does not.

    If I select “uploaded to this post” from the media area within a post I can see that the image is considered to be attached to the post.

    I am wondering if there is a new $arg we should be passing to get_posts?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Image attachments – available?’ is closed to new replies.