Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have this while loop in my product page with Wordpress e-commerce plugin. It is looping through custom post meta.

<?php if (wpsc_have_custom_meta()) : ?>
    <?php $count = 2; ?>
    <?php while ( wpsc_have_custom_meta() ) : wpsc_the_custom_meta(); ?>
    <?php if (stripos(wpsc_custom_meta_name(),'g:') !== FALSE) continue; ?>
        <a href="#tab<?php echo $count; ?>"><?php echo wpsc_custom_meta_name(); ?></a>
    <?php $count ++; ?>
<?php endwhile; ?>
<?php endif; ?>    

I repeat this twice. Once to iterate through tab titles and once through the tab body. But for some reason the second instance of the while loop won't work. If I delete the first instance then the second one works as expected but as soon as I have to examples of it then it no longer works. Thanks for the help.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

It doesn't appear possible to loop over the values multiple times without directly manipulating the current_custom_meta class var so that wpsc_have_custom_meta() will return true again. Give this a try before the second while loop:

global $wpsc_custom_meta;
$wpsc_custom_meta->current_custom_meta = -1;
share|improve this answer
You are a wizard. Thanks! –  motleydev Feb 12 '13 at 17:09

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.