WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

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 
share|improve this answer

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

share|improve this answer
Please consider adding some explanation. Links only answers will be flagged as "poor quality" by the "community user" bot. – kaiser Aug 7 '12 at 15:37
I don't get it - the plugin does exactly what the poster asked for. What other explanation is needed? – Dalton Aug 7 '12 at 17:54
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 '12 at 18:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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