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 use this plugin : http://wordpress.org/support/plugin/more-fields/page/2

How use WP_QUERY for this inputs ?!

share|improve this question
1  
What exactly are you trying to accomplish? What have you done already? –  Krzysiek Dróżdż Dec 6 '13 at 8:02

1 Answer 1

More fields Plugin is to enter additional input into the post, page etc. And that is Custom Fields in WordPress.

To use WP_Query() for those Custom Fields input, you have to query for the meta_key.

<?php
//Query for only my custom field value
$args = array(
          'meta_key' => 'your_field_key'
        );

$wpse_query = new WP_Query($args);

while( $wpse_query->have_posts() ):
$wpse_query->the_post();

   if( get_post_meta( $post->ID, 'your_field_key', true ) != '' ):
      echo get_post_meta( $post->ID, 'your_field_key', true );

endwhile;
?>

Learn more from Codex: WP_Query() - Custom Field Parameters.

More related answers can be found HERE.

Additionally, More Fields plugin is not actively maintained, so it's not fit for updated WordPress. Better use other plugins like: Advanced Custom Fields, or the like.

share|improve this answer
    
Thx, How use check variable is exists ? after this code : 'meta_key' => 'your_field_key' check your_field_key == 'ok' ? –  Mohammad Dec 6 '13 at 11:04
    
Updated the answer with an if() before the echo. If the answer satisfy your need, don't forget to upvote it and mark the answer as accepted. We guys work here for reputation. :) –  Mayeenul Islam Dec 6 '13 at 15:48

Your Answer

 
discard

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.