Unable to get fields to show up
-
So i’ve been running into some issues getting my posts to display. I’m getting error messages relating to foreach() that i don’t understand and have tried several simple changes with no effect.
I have a metabox named wp_student.(meta name is also wp_student)
I’m making a portfolio so i have a bunch of fields relating to items. for the sake of this page all i need are the portfolio images (everyone submitted 3 images) so student_image_1, student_image_2, and student_image_3. as well as their titles (student_image_1_name, student_image_2_name, student_image_3_name). for the time being i’ve just been trying to figure out how to get things to appear. I watched the tutorial and it seemed so simple. I’ve been tinkering a bit so it may not be exactly the same but it quite possible that it still is. i’m not to sure at this point. My confusion lies in the fact that when the tutorial was done, the foreach() seemed like the meta name and a random name. Is this not the case? anyway, this is what i have. Any help would be greatly appreciated.<?php /* run the loop */ if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <?php $wp_student = get_post_meta($post->ID, 'wp_student', true ); echo '<div class="picture_name">'; foreach($wp_student as $wp_students) { echo '<img src="' . $wp_students['student_image_1'] .'" />'; echo '<h3>' . $wp_students['student_image_1_name'] . '</h3>'; } echo '</div>'; ?>
https://www.ads-software.com/plugins/wck-custom-fields-and-custom-post-types-creator/
- The topic ‘Unable to get fields to show up’ is closed to new replies.