Display metabox title for custom fields with values

You can add another simple foreach loop to check if you have any values first: foreach ( $meta_boxes as $metabox ) { $has_value = false foreach ( $metabox[‘fields’] as $field ) { $meta = get_post_meta($post->ID, $field[‘id’], true); if(!isset($meta[0])){ $need_title = true; break; } } if ($has_value){ echo $metabox[‘title’]; foreach ( $metabox[‘fields’] as $field ) { … Read more

Show Custom Field of Current Page in For Loop

You must pass the $post->ID to the function or setting up the current post via a call to $specialPosts->the_post() that fills it for you See get_post_custom_values documentation in the codex or this page on how to use it. Try <?php $specialPosts = new WP_Query(); $specialPosts->query(‘pagename=page-‘.$i.”); while($specialPosts->have_posts()): $specialPosts->the_post(); $mykey_values = get_post_custom_values(‘custom_select’); foreach ( $mykey_values as $key … Read more

Get array of posts based on custom field values

Look at the meta_query argument, and the “IN” option for the “Compare” operator. Your query would look something like: $args = array( ‘product’ => $product, ‘meta_query’ => array( array( ‘key’ => ‘primary_link’, ‘value’ => array( ‘home’, ‘obj_handling’, ‘standalone_doc’, ‘advantages’, ‘weaknesses’, ‘top_comments’ ), ‘compare’ => ‘IN’ ) ) );

How to display data from custom fields I created?

I think you want to look into using get_post_meta and then display it with that. Here it is on the Codex: http://codex.wordpress.org/Function_Reference/get_post_meta You can look at this example: <?php echo get_post_meta($post->ID, $prefix.’where’, true); ?> That should get you what you need if I understand the question correctly.