WordPress.org

Ready to get started?Download WordPress

Forums

How to exclude images from post gallery but keep in post? (22 posts)

  1. Caracco
    Member
    Posted 4 years ago #

    This might seem like a strange question, but I'd really like to know if it's possible to add images to a post and not have them all show up in a gallery?

    Now first things first, I know how to insert an image as full size, and I know how to insert a gallery post, but can I do them separately in the same post?

    Here is an example from my blog. Ignore my fangirling.

    As you can see, the first image is an illustration, and the rest are photos. I don't want the illustration to show up with the photos. Let me know if this is possible, thanks~! I hope it isn't a really simple answer, lol.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    Upload the illustration using Admin/Media/Add New. This will ensure that the illustration does not have an association with any specific post. When creating the post, use the Gallery tab in Add Media to locate the illustration and add it to your post. Then upload your other photos as per normal whilst editing the post and publish the post's gallery.

    An image will only be included in a post's gallery if it has a direct association with that post (ie been uploaded whilst creating/editing the post).

  3. iblogie
    Member
    Posted 4 years ago #

    That's exactly what I did, esmi -- uploaded an image via Admin/Media/Add New. Like Caracco, I also want to have an image appear on a post, but not have this particular image appear in the gallery grid on the post.

    But, when I inserted the image in question to the post (from Media Library), it was automatically associated with the in-post gallery, and appeared in the post's gallery grid. When I checked the post's gallery, this image was indeed in the gallery.

  4. Brand Relations
    Member
    Posted 4 years ago #

    Indeed, I tried it too and it doesn't solve the problem. I was googling to find out if there's someone who made an attempt to help us :)

    Here's the information that i"ve found

    Filter images from WordPress [gallery]

    Hope it will be useful :)

    Best Regards,
    Brand Relations

  5. Shawn
    Member
    Posted 4 years ago #

    The easiest way to do this is to upload your images for your gallery in your post like normal and add the gallery to your post.

    Then, as esmi mentioned, go to Media> Add New. Add the images you don't want to appear in your post gallery to the Media Library.

    Copy the link to each image and use the plain 'ol Insert/edit image button (or img from HTML view) in the post. Paste the links to the images there.

    A bit of a hassle, but it works.

  6. kestutis
    Member
    Posted 4 years ago #

    I found like there, but bit easy way, even then images are uploaded, how to exclude from gallery, but keep in post.
    So images uploaded, but one of them need to exclude from gallery, but keep in post.
    Go to Admin/Media and delete image which want to exclude from gallery. Then upload again there Admin/Media/Add new. That's all.

    New uploaded image has same path to it, so normally appear on post where it was before, but do not appear in gallery, because now isn't associated with any post.

  7. Scott R Asher
    Member
    Posted 4 years ago #

    I do have the fix for this issue, I have made a free WordPress plugin that will exclude an image from the gallery and place in a post. http://scottrasher.com/wordpress-plugin-for-excluding-gallery-pictures-for-adding-to-post/

  8. buskerdog
    Member
    Posted 4 years ago #

    Neither the method outlined nor the plugin are working for me in 2.9.1. If I use the general media upload then when I add the image to the post from the media library the it automatically gets added to the post's gallery as well. Then if I delete the image from the gallery it removes it from the media library too!

    The plugin both doesn't work AND screws up the styling for the gallery...

  9. knivesOut
    Member
    Posted 4 years ago #

    I have this same issue as well. This should be corrected in a future WP release.

  10. buskerdog
    Member
    Posted 4 years ago #

    The Multiple Galleries plugin solves this very well, but there's a fix in the comments section that needs to be implemented before it'll work in 2.9 until he incorporates the fix into a new release...

  11. RyanWilliams
    Member
    Posted 4 years ago #

    WordPress allows you to exclude images via the shortcode as of WordPress 2.9. You need to go to HTML view and add:

    exclude="ID_OF_ATTACHMENT"

    So for example:

    [gallery exclude="2192" link="file" columns="9" orderby="title"]

    This definitely needs better GUI implementation, but it works.

  12. realtm
    Member
    Posted 4 years ago #

    Hi all,

    Gallery exclude and include is broken in wordpress 2.9.1
    I want some confirmation before adding a bug ticket

    cheers

  13. buskerdog
    Member
    Posted 4 years ago #

    Pretty sure it works.

    FYI, this is the plugin I mentioned a few posts up:
    http://konstruktors.com/blog/projects-services/wordpress-plugins/multiple-galleries/

    It removes the need to manipulate the shortcode (although obviously it's good to be able to play with the shortcode as neeeded)

  14. kayden
    Member
    Posted 4 years ago #

    The plugin seems to take away the ability to even open up the "Insert Gallery" tool when editing a post for me. None of the buttons work when I click on them. It could be a compatibility issue with other plugins I have activated, but I can't get rid of them. That plugin is supposed to work with 2.9.1? It seems like it would be a useful plugin, in fact it seems like something WordPress should have implemented in the first place.

    How stupid it is that you're forced to include every image used in the post in the gallery. I'm being forced to use a "spacer" image, just one pixel wide, in order to put non-breaking spaces in my posts, thanks to another one of WordPress's ridiculous idiosyncrasies, (ereasing all the non-breaking spaces I input), and now my galleries have a spot reserved for that spacer image. :( Dumb.

    And no, the exclude attribute in the gallery tag does not work for me, sadly. I don't mind writing shortcode, but it doesn't work for me. :(

  15. buskerdog
    Member
    Posted 4 years ago #

    Something is definitely wrong with the plugin I posted (which is weird because I got it to work on one 2.9.1 installation and use it!) I don't know what happened.

    As for exclude in shortcode, try include and see if that works. Because I've used that and had no problem but I don't know if I've used exclude.

  16. Carlo Rizzante
    Member
    Posted 4 years ago #

    Hi all! Anyone tried to solve a similar problem with Gallery and Thumbnail? I explain myself better. I've images which I want to show up in the Gallery. And later I've upload an image (totally different size), to use as Thumbnail.

    Indeed, the Thumbnail picture shows up at the end of the other pictures in the Gallery. Ok, not a big issue. But I would like to set this one off from the Gallery. I'm sure there is a simple solution. I just wander to find it... :)

  17. Carlo Rizzante
    Member
    Posted 4 years ago #

    By the way, "exclude" works fine in the Gallery short code. Well, at least in my case.

  18. IdeFixx
    Member
    Posted 4 years ago #

    Hi buskerdog,
    try to change in "multiple-galleries.js" file on the line 61 (put commas between picture IDs):
    $to_include += '' + $imgid + ',';

    Also posted here.

  19. BeRuud
    Member
    Posted 4 years ago #

    I just ran into this problem today.

    I coded the [gallery] with EXCLUDE="1,2,3,4" and it did nothing. I assigned the pictures numbers but to no avail then tried again, I even used the name of the picture instead of the assigned number.

    It is a pain in the bum, but I loaded the images separate in the media upload area of wordpress, copied the thumbnail and main image location and HTML scripted my own gallery.

    Hopefully the upgrade to Word press 3 will acknowledge this, it is kind of a pain!

  20. superkev
    Member
    Posted 4 years ago #

    The EXCLUDE feature would be the ideal fix for me for this issue, but it doesn't seem to do anything. I'm using 2.9.3.

  21. superkev
    Member
    Posted 4 years ago #

    Ok EXCLUDE does work for me. I just didn't know where to get the image ID from. You have to insert the image into the post, then look at the HTML. You'll see the ID in the CSS class that WordPress generates for that image's IMG tag. For instance, mine image's IMG tag had:

    class="size-medium wp-image-1017 alignnone"

    So the image ID is 1017. I used the short code:

    [gallery exclude="1017" link="file" orderby="menu_order ASC"]

    and it left that image out of my gallery. It would be great to have this feature integrated into the GUI in future versions.

  22. RyanWilliams
    Member
    Posted 4 years ago #

    There is an easier way to get the ID, but it still really needs just putting right in the media uploader as like a checkbox or something.

    Go to the main media library in your WordPress sidebar, and when you click 'Edit' on any of them the ID will be in the URL. You can obviously also preview the URL by just hovering over it.

Topic Closed

This topic has been closed to new replies.

About this Topic