Error: Invalid argument supplied for foreach()
-
Warning: Invalid argument supplied for foreach() in C:\wamp64\www\wordpress\wp-content\themes\uniao-site\index.php on line 42
<?php add_filter( 'rwmb_media_add_string', 'prefix_change_add_string' ); function prefix_change_add_string() { return '+ Adicionar imagens'; } add_filter( 'rwmb_meta_boxes', 'meta_box_slide' ); function meta_box_slide( $meta_boxes ) { $meta_boxes[] = array( 'title' => 'Imagens do Slide', 'post_types' => 'slide', 'fields' => array( array( 'id' => 'image', 'name' => 'Imagens', 'type' => 'image_advanced', // Delete image from Media Library when remove it from post meta? // Note: it might affect other posts if you use same image for multiple posts 'force_delete' => false, // Maximum image uploads. 'max_file_uploads' => 4, // Do not show how many images uploaded/remaining. 'max_status' => 'false', // Image size that displays in the edit page. 'image_size' => 'thumbnail', ), ), ); return $meta_boxes; }
<?php $args = array( 'post_type' => 'slide' ); $query = new WP_Query( $args ); if ( $query->have_posts() ) { echo '<ul class="category posts">'; // Start looping over the query results. while ( $query->have_posts() ) { $query->the_post(); ?> <li <?php post_class( 'left' ); ?>> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> <?php the_title(); ?> </a> <?php $images = rwmb_meta( 'info', array( 'size' => 'thumbnail' ) ); foreach ( $images as $image ) { echo '<a href="', $image['full_url'], '"><img src="', $image['url'], '"></a>'; } ?> </li> <?php } echo '</ul>'; } // Restore original post data. wp_reset_postdata(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Error: Invalid argument supplied for foreach()’ is closed to new replies.