<?php
// Получаем посты:
$args = [
'numberposts' => 5,
];
$posts = get_posts( $args );
// В массиве $posts будет содержаться 5 постов, нумерация от 0 до 4.
// Каждый пост - это объект типа WP_Post со всеми стандартными свойствами.
// Далее просто формируем HTML и в нужном месте берем пост по индексу и выводим его свойства:
?>
<div class="row">
<div class="col-6">
<div class="post-card">
<?php
echo get_the_post_thumbnail( $posts[0], 'custom-size', [ 'class' => 'img-fluid' ] );
echo get_the_title( $posts[0] );
?>
</div>
</div>
<div class="col-3">
<div class="post-card">
<?php
echo get_the_post_thumbnail( $posts[1], 'custom-size', [ 'class' => 'img-fluid' ] );
echo get_the_title( $posts[1] );
?>
</div>
<div class="post-card">
<?php
echo get_the_post_thumbnail( $posts[2], 'custom-size', [ 'class' => 'img-fluid' ] );
echo get_the_title( $posts[2] );
?>
</div>
</div>
<div class="col-3">
<div class="post-card">
<?php
echo get_the_post_thumbnail( $posts[3], 'custom-size', [ 'class' => 'img-fluid' ] );
echo get_the_title( $posts[3] );
?>
</div>
<div class="post-card">
<?php
echo get_the_post_thumbnail( $posts[4], 'custom-size', [ 'class' => 'img-fluid' ] );
echo get_the_title( $posts[4] );
?>
</div>
</div>
</div>
// disable acf css on front-end acf forms
function my_deregister_styles()
{
wp_deregister_style( 'acf' );
wp_deregister_style( 'acf-field-group' );
wp_deregister_style( 'acf-global' );
wp_deregister_style( 'acf-input' );
wp_deregister_style( 'acf-datepicker' );
}
add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
Писать свой ajax обработчик, когда в Wordpress есть admin-ajax.php ?
данный код нужен только для динамического поиска и вывода статей из БД без перезагрузки страницы