• Resolved wargazm

    (@wargazm)


    Hello,
    I am very new to WordPress. I think I’m getting the hang of it, but there’s obviously a lot to learn!

    Here’s my questions:
    1) Is there a way to tag images?
    1.1)What kind of PHP functions can I use to read out the contents of the media library? Ideally, I’d love a function that would return all images in the library tagged with a given keyword.
    2) Is there a way to attach more than one image to a post?
    2.1) What functions can I use to return the link to an image attached to a post?

    Thanks for the help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • 1a. No – unless there’s a plugin somewhere that offers this functionality

    1b. <?php query_posts('post_type' => 'attachment');?> might get you started.
    http://codex.wordpress.org/Function_Reference/query_posts

    2a. Yes – you can attach as many images to a post or page as you want. The easiest method is to upload the images whilst editing the relevant post or page.

    2b. http://codex.wordpress.org/Function_Reference

    Thread Starter wargazm

    (@wargazm)

    Thanks for the reply, esmi. I ended up using your suggestion for 2b to get what I needed.

    One more thing that isn’t clear from the Function Reference…say I use

    <?php query_posts('post_type' => 'attachment');?>

    to get a list of attachments. How, then, can I get the ID of the post that each item in that list is attached to?

    So, if the above code returns Image A, how can I get to the post that Image A is attached to?

    thanks.

    Off the top of my head, $post->post_parent should give you the id of the relevant post.

    You might want to try the plugin SuperSlider-Media-Pop

    **New Features v1.1**

    * Adds column post ID to edit post list.
    * Adds media attach – detach function to edit media screen.
    * Adds minithumb and links to attachment column in the edit post list.
    * Adds columns caption/description/alt-text/id to Media Library list page.
    * Adds Enhanced Mass Image Edit to the Media upload screens.

    * mass edit Alternate text
    * mass edit Description text
    * mass edit attached to Parent ID
    * mass edit all Available image sizes to insert

    **Features**

    * Add thumbnails to your edit posts / page screen.
    * Add Attachments in this post to your edit posts / page screen.
    * Link your image to any sized pop over.
    * Insert any image size available for the active image. (WP 3.0+)
    * Access any superslider scaled image (ss-Show, ss-PNext, ss-Excerpt all offer custom image size creation.)WP 2.9
    * Set the jpeg image quality of dynamically created image versions

    There is one more problem that I could not sort out with WP…

    What is the idea behind attaching an image in media library? It doesn’t really get pasted into your post? You have to do it manually…
    Then what is the use of this attaching feature…?

    Secondly why we cannot insert multiple images into post at a single stroke…? We have to do it manually for every image…

    Will you please explain this…?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Attach multiple images to a post / functions to read image library?’ is closed to new replies.