Answer the question
In order to leave comments, you need to log in
How to display custom posts (Custom Post Type UI) via WP_Query by custom field (ACF)?
Help, please, deal with WP_Query.
Now the output of posts (the personal slug) looks like this:
<?php $loop = new WP_Query( array( 'post_type' => 'personal', 'posts_per_page' => 20 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php echo the_post_thumbnail_url(); ?>
<?php echo the_title(); ?>
<?php echo the_content(); ?>
<?php endwhile; ?>
<?php wp_reset_query();?>
Answer the question
In order to leave comments, you need to log in
Try like this
$args = [
'post_type' => 'personal',
'posts_per_page' => 20,
'meta_query' => [
[
'key' => 'otdel',
'value' => '"buhuchet"',
'compare' => 'LIKE'
]
]
];
$loop = new WP_Query( $args );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question