• Hello

    I have add a field in post dcvbpl_banhanh and add value B? th?y s?n

    and have Query post by text field:

    <?php
    $args = array(
    	'numberposts'	=> 10,
    	'post_type' => 'post',
    	'meta_key'		=> 'dcvbpl_banhanh',
    	'meta_value'	=> 'B? th?y s?n',
    );
    $the_query = new WP_Query( $args );
    ?>
    <?php if( $the_query->have_posts() ): ?>
    <div class="wapsdblist">
    	<h3><?php the_field('dcvbpl_banhanh'); ?></h3>
    	<ul>
    <?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
    		<li><i class="fa fa-check-circle-o"></i> <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?>
    	</ul>
    </div>
    <?php endif; ?>
    <?php wp_reset_query();	 // Restore global post data stomped by the_post(). ?>

    But my code is not show list post true value.

    Give me any idea. any support for help me.
    Thanks

    https://www.ads-software.com/plugins/advanced-custom-fields/

  • The topic ‘Query post by text field’ is closed to new replies.