// Регистрируем кастомные типы записей и таксономии
add_action('init', 'register_post_types');
function register_post_types(){
// Отзывы
register_post_type('testimonial', array(
'label' => 'Отзыв',
'labels' => array(
'name' => 'Отзывы',
'singular_name' => 'Отзыв',
'add_new' => 'Добавить новый',
'add_new_item' => 'Введите заголовок',
'edit_item' => 'Редактирование отзыва',
'new_item' => 'Новый отзыв',
'view_item' => 'Посмотреть отзыв',
'search_items' => 'Поиск отзыва',
'not_found' => 'Отзывов не найдено',
'not_found_in_trash' => 'В корзине отзывов не найдено',
'parent_item_colon' => '',
'menu_name' => 'Отзывы',
),
'description' => 'Отзывы наших клиентов',
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'show_ui' => true,
'show_in_menu' => true,
'show_in_admin_bar' => true,
'menu_position' => 23,
'menu_icon' => 'dashicons-format-quote',
'capability_type' => 'post',
'map_meta_cap' => true,
'hierarchical' => false,
'supports' => array('title'),
'has_archive' => true,
'rewrite' => array('slug' => 'testimonials', 'with_front' => false),
'query_var' => true,
) );
}
<?php Template Name: Add testimonial ?>
<?php
acf_form_head();
get_header();
?>
<section id="add_testimonial" class="type-page">
<div class="wrapper">
<?php
acf_form(array(
'post_id' => 'new_post',
'post_title' => false,
'post_content' => true,
'new_post' => array(
'post_type' => 'testimonial',
'post_status' => 'draft'
),
'return' => home_url('thank-you'),
'submit_value' => 'Опубликовать'
));
?>
</div>
</section>
<?php get_footer(); ?>
'post_status' => 'draft' draft на publish
<div class="reviews-wrap">
<?php
$args = array(
'post_type' => 'testimonial',
'post_status' => 'publish',
'posts_per_page' => '4',
);
query_posts( $args );
if ( have_posts() ) :
?>
<?php while ( have_posts() ) : the_post() ?>
<div class="review">
<div class="text-info">
<div class="date"><?php echo get_the_date('d-m-Y'); ?></div>
<div class="desc">
<div class="text_testimonial">
<?php the_field('testimonial_text'); ?>
</div>
<div class="readmore_testimonial">
<a>Читать полностью...</a>
</div>
</div>
<div class="names"><a href="<?php the_field('testimonial_social'); ?>"><?php the_field('testimonial_name');?></a> / <a href="<?php the_field('testimonial_link'); ?>"><?php the_field('testimonial_profession'); ?> - <?php the_field('testimonial_work'); ?></a></div>
</div>
</div>
<?php endwhile ?>
<?php endif ?>
</div>
<img src="<?php the_field('NAZVANIE_POLYA');?>"/>