WordPress.org

Ready to get started?Download WordPress

Forums

wordpress 2.5 gallery from other posts (20 posts)

  1. technabob
    Member
    Posted 6 years ago #

    I love the new gallery feature in WP 2.5, but I was wondering if anyone knows a way that I could build galleries using images from other posts (i.e. the ones in the image library)?

    Basically, I'd like to do a weekly recap gallery of my favorite posts, and each thumbnail could be pulled into a gallery which would link back to the original posts. I know I can do this manually with the image browser, but that doesn't automatically arrange the images or add captions.

  2. Michael Fields
    Themer
    Posted 6 years ago #

    technabob,
    Hi, was wanted something similar, but got no replies. If you are php savy, the new WordPress short code api is pretty nice imho and easy to work with to boot. I was able to overwrite the functionality of the [gallery] short tag in about 20 minutes.

    I came up with a simple plugin that I think both of us ( and probably others ) will benefit from. right now, you can get it in the code bin. GPL - no warranty :)

    Basically, it preserves all functionality of the original [gallery] tag plus it adds one more attribute: "ids" which is a comma separated string of attachment ids for the images that you want included in the gallery.

    Example usage: [gallery ids="42,43"]

    This should get you started on your weekly recap and will definately help me out.

    Please let me know how this works for you,
    -Mike

  3. BioTecK
    Member
    Posted 6 years ago #

    Hello mfields,

    Nice plugin! Only when I activate the plugin and use the [galley ids="12,43"] I get "Missing Attachment". What do I do wrong!

  4. Michael Fields
    Themer
    Posted 6 years ago #

    I've only received this error when the ID that I entered was not a valid attachment ID. Please check that 12 and 43 reference posts with post_type set to attachment.

    BTW: Here is a link to the plugin's page on my site. I made a few updates to it after I created the post above.

  5. minute44
    Member
    Posted 6 years ago #

    Bet it doesn't eliminate the styles it just throws in the middle of your nice clean xhtml though right?

  6. Michael Fields
    Themer
    Posted 6 years ago #

    minute44,

    Not quite sure what you mean?

  7. minute44
    Member
    Posted 6 years ago #

    the gallery shortcode function inserts a gallery into the post... but rather than giving you the option to use your own style sheet to tell it how to look, it bungs it's own styles in.... right in the middle of your XHTML, making it no longer validate.

  8. Michael Fields
    Themer
    Posted 6 years ago #

    minute44,
    I never even noticed that - Good catch. I'll see what I can come up with.

  9. minute44
    Member
    Posted 6 years ago #

    I hope it gets fixed because it's the only thing stopping me using what is actually a cracking feature!

  10. BioTecK
    Member
    Posted 6 years ago #

    2 mfields:

    I have inserted the ID's of the post with the gallery tag in it. So I have create a page and put this in it:
    [gallery ids="863,1136,944,1374,1389,827,887,774,1352,1124,1175,565"]

    Is this what you mean??

  11. Michael Fields
    Themer
    Posted 6 years ago #

    minute44,
    Hi, I have uploaded a new version (v0.1.1) of the plugin which will (should) produce valid xhtml.

    BioTecK,
    Maybe.... just so long as the ids are valid ID's of attachments and NOT posts that contain attachments.

  12. minute44
    Member
    Posted 6 years ago #

    so that will stop [gallery] from putting any style information in the HTML will it?

  13. Michael Fields
    Themer
    Posted 6 years ago #

    Sure will, It will also provide an alt tag to images and remove the mysterious </p> that appears at the end of the [gallery] structure. Also, all of the other attributes supported by the gallery tag should work, along with the 'ids' that I added.

  14. minute44
    Member
    Posted 6 years ago #

    Sounds promising mate.

    I'll check it out tomorrow when i have more time on my hands.

    If it does what you say, I owe you a beer.

  15. Michael Fields
    Themer
    Posted 6 years ago #

    Right on.
    Good luck with it!

  16. BioTecK
    Member
    Posted 6 years ago #

    Aaa.. I see! But where can I find the ID's of attachments? :)

  17. minute44
    Member
    Posted 6 years ago #

    Does it not display them when you upload the gallery?

  18. BioTecK
    Member
    Posted 6 years ago #

    When I upload a bunch of picture to a post all I see is the [gallery] tag!

  19. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    To see ID's of things in the interface, use this plugin. Then go to the Manage pages and look at various things. New columns abound:
    http://wordpress.org/extend/plugins/reveal-ids-for-wp-admin-25/

  20. BioTecK
    Member
    Posted 6 years ago #

    GREAT!
    Thnx Otto for the tip! Now I know the ID's of attachments and with this, the plugin of Mr. mfields works!!

    Thnx a lot!! :D

Topic Closed

This topic has been closed to new replies.

About this Topic