0

I wonder if Wordpress is the best CMS or solution for what I wannt to do?

I need to find some way to upload images to a post that I can loop as background images. Just like I can upload multiple images and Wordpress automatically creates a gallery I don't want that to happen, but use those images directly (without any thumbnails or whatsoever) and be able to create a javascript slideshow that loops through those images.

So actually I probably need some way of creating a javascript array within php when I upload images to a post. And when viewing the post I can then loop through this array with javascript.

Any idea how to write a function that does that? However I might need single images inside the post - just no galleries.

Ideas on that? Tipps or tricks? Is there probably a plugin out there that does that?

2 Answers 2

1

You can do that within the loop using wp_get_attachment_image.

Something like (not tested):

//loop starts

//values for get_posts ( or wp query if you prefer)
$args = array(
   'post_type' => 'attachment',  //gets the attachments aka your images
   'numberposts' => -1,
   'post_parent' => $post->ID
  );

// some attributes you want added to each image   
$default_attr = array(
   'class'  => "background-attachment", //for your javascript
   'alt'   =>  'something',
   'title' => ''something
);

//loops through the attachments,
//uses the 'full' parameter assuming you want the default large image
$attachments = get_posts($args);
if ($attachments) {
    foreach ($attachments as $attachment) {
         echo wp_get_attachment_image($attachment->ID, 'full', false, $default_attr);
    }
}

//loop ends
//your javascript for full page background via wp_enqueue_script 
0
0

I think this plugin will do the trick: http://wordpress.org/extend/plugins/wp-supersized/

3
  • Please consider adding some explanation. Links only answers will be flagged as "poor quality" by the "community user" bot.
    – kaiser
    Aug 7, 2012 at 15:37
  • I don't get it - the plugin does exactly what the poster asked for. What other explanation is needed? Aug 7, 2012 at 17:54
  • 1
    The system of the SE network (this "problem" is on all sites here on SE) considers itself to not be a link sharing engine/extended google. So the bot flags such questions pretty quickly to force you to add more info. For example: "How to use the plugin", "What the plugin exactly does", "The plugin is coded well/crappy".
    – kaiser
    Aug 7, 2012 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.