<?php
$args = array(
'theme_location' => 'head_menu', // локация меню
'menu' => '',
'container' => 'nav', // контейнер, если нужен
'container_class' => '',
'container_id' => '',
'menu_class' => '',
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '%3$s',
'depth' => 0
);
wp_nav_menu( $args );
?>
<?php
$array = array();
$cur_terms = get_the_terms( $post->ID, 'genres');
foreach( $cur_terms as $cur_term ){
$array[] = $cur_term->name;
}
$comma_separated = implode(", ", $array);
echo $comma_separated; // term1, term2, term3
?>
<?php
$posts = get_field('relationship-field');
if( $posts ):
$new_posts = array(); ?>
<?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post);
$new_posts[] = '<a href="'.get_the_permalink().'">'.get_the_title().'</a>'; // сложили все в массив
?>
<?php endforeach;
$done_post = implode(",", $new_posts);
echo $done_post; ?>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
global $wp_query;
query_posts(
array_merge( // склеиваем массивы
$wp_query->query, // это массив базового запроса текущей страницы
array('posts_per_page' => 5) // это параметры который добавили мы
)
);
// Дальше цикл
define('DB_CHARSET', 'utf8mb4');
define('DB_CHARSET', 'utf8');