Retrieving Custom Field Dropdown Menu Value - What's wrong with my code?

Inactive
  • 39 points
    Starting to get into this DEV thing
    I'm new here
    AC

    Member  —  26th September 2011 (8 months ago)         

    Hello all,

    I'm having a bit of trouble getting custom field dropdown menu values to display in my page. FYI - I created the dropdown menu in Custompress. There must be something wrong with my code, right?

    The dropdown menu/select box code starts halfway through...

    <?php $args = array( 'post_type' => 'mobile_coupons', 'posts_per_page' => 10 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    ?>
    <a href="<?php echo the_permalink(); ?>"title="<?php echo the_title(); ?>">
    <?php echo the_title(); ?></a>
    <br />
    <?php echo get_post_meta( $post->ID, '_ct_text_4e7ad564c7f49', true ); ?>
    <?php if ( get_post_meta( $post->ID, 	'_ct_selectbox_4e7ad65e26556', true ) ) {
    foreach ( get_post_meta( $post->ID, '_ct_selectbox_4e7ad65e26556', true )
    as $value ) { echo $value . ', '; }} ?>
    <br />
    <?php echo get_post_meta( $post->ID, '_ct_text_4e7ad92dbec36', true ); ?>
    <br />
    <?php
    echo '<div class="entry-content">';the_content();
    echo '</div>';
    endwhile;
    ?>

    And here is the error message I get when I view the page:

    Warning: Invalid argument supplied for foreach() in /home5/apowerin/public_html/smartdepartment/wp-content/wptouch-data/themes/sdpt1/iphone/mobile-coupon-list.php on line 29

    Thanks as always you guys are a great help. Cheers!

    Sd