Я создал шорткод, чтобы показать все отзывы на одной странице.
Я создал пользовательский тип сообщения, чтобы добавить каждый отзыв.
Кто-нибудь может сказать мне, как показать все отзывы на одной странице.
этот код используется для создания sshortcode
ниже я упоминаю код: -
<code>function fn_testimonials_block()
{
$args = array(
'post_type'=> 'testimonials',
'order' => 'ASC'
);
$the_query = new WP_Query( $args );
$pages = $the_query->posts;
//echo "<pre>";
//print_r($pages);
//echo "
";
//выход;
$ output = '';
$ count = 1;
foreach ($ pages как $ page) {
// -----------------
$ author = $ page-> post_title;
$ testimonial = $ page-> post_content;
$ page_url = get_page_link ($ page-> ID);
$ author_image = get_the_post_thumbnail_url ($ page-> ID, 'thumbnail');
если ($ count% 2 == 1)
{
$ output. = '
';
}
$ output. = '
'. $ Свидетельство.
'. $ Author.',
';
если ($ count% 2 == 0)
{
$ output. = '
';
}
$ Подсчитывать ++;
}
if ($ count% 4! = 1) {
$ output. = '';
}
вернуть $ output;
}