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'm using the WP Supersized plugin to load background images on posts and works fine.

The problem I have at this point is I want to show the latest post in cat 17, with custom field key FeaturedOnHomepage, with value yes on my homepage and display the background images from that post. Below the query I use:

        <?php query_posts('cat=17&posts_per_page=1&meta_key=FeaturedOnHomepage&meta_value=yes'); ?>
        <?php if (have_posts()) : ?>
        <?php while (have_posts()) : the_post(); ?>
            <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>   
        <?php endwhile; ?>    
        <?php else : ?>    
        <?php endif; ?>

Somehow WP Supersized is getting confused and is showing the default image folder (like all images in the Media Library. Do I need to include code to make this work?

share|improve this question
Does supersized behave correctly when you comment that code out? – Tom J Nowell Aug 22 '12 at 12:48
It does work with the default single.php. No problems at all. Looks like with my custom query WP Supersized doesn't know which post ID it needs to figure out the correct gallery to link. – AKNL Aug 22 '12 at 13:05

Avoid this function at all costs. The likely cause of your problem is queries not cleaning up after eachother. Your call to query_posts will have modified the main query ( wasting the original ), and messed up everything following it.

Instead use WP_Query followed by wp_reset_postdata

$query = new WP_Query('cat=17&posts_per_page=1&meta_key=FeaturedOnHomepage&meta_value=yes');
    while ($query->have_posts()) {
        ?><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a><?php
} else {
    // you didn't put anything here either

You should format your code appropriately, too many , and don't use the if(): endif; stuff, it's cluttering up your code and preventing code editors from matching braces

share|improve this answer
Thanks Tom, I changed the query, but still having the same behavior with WP Supersized. I'm using WP Media Gallery (images from the WP Media gallery attached to this page/post will be used) as origin. Maybe that isn;t the best option. Going to try NextGen option. Anyone else has an idea on how to fix this/ – AKNL Aug 22 '12 at 12:22
NextGEN isn't working. It looks like when I'm using a custom query WP Supersized can't find the connected image gallery. – AKNL Aug 22 '12 at 12:34
I've seen many a person tear their hair out dealing with nextgen. Check your error log – Tom J Nowell Aug 22 '12 at 12:47

Tried a couple of things:

  • changed query
  • tried all settings in the WP Supersized adminpanel
  • tried custom folder, nextGen, wp gallery options

Nothing worked. The problem is that WP Supersized is confused and doesn't recognizes the attached post gallery origin. Anyone knows a solution to fix this?

share|improve this answer
up vote 0 down vote accepted

Never mind. Switched to http://www.ajaxblender.com/bgstretcher-2-jquery-stretch-background-plugin-updated.html

Much more control and working like a charm.

share|improve this answer

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.