acf meta field query
$posts = get_posts(array(
'numberposts' => -1,
'post_type' => 'post',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'color',
'value' => array('red', 'orange'),
'compare' => 'IN',
),
array(
'key' => 'featured',
'value' => '1',
'compare' => '=',
),
),
));
// args
$args = array(
'numberposts' => -1,
'post_type' => 'event',
'meta_key' => 'location',
'meta_value' => 'Melbourne'
);
// query
$the_query = new WP_Query( $args );
?>
<?php if( $the_query->have_posts() ): ?>
<ul>
<?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>">
<img src="<?php the_field('event_thumbnail'); ?>" />
<?php the_title(); ?>
</a>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
Also in PHP:
- capitalize letter in php
- create a new folder php
- composer install laravel installer
- codeigniter return last inserted id
- Activate errors tracking in your script using the ini_set() function
- destroy php variable
- How to show php text
- find number of characters in word php
- SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long
- clear single cache laravel 6
- alert laravel 7
- create a laravel project php 8
- date('d') in php
- change maximum execution time php
- cache laravel
- "$_HEADER" php
- STING INCLUDSE A CARACTHER PHP
- catch new exception php
- date('hms'
- convert timestamp to readable date and time
- doctrine fixture bundle
- currentdate function in php
- clear cach in laravel
- codeigniter 4 query builder select