Вставляйте в переменную JS шорткод формы и потом уже выводите его, а не в переменную php
<?php
$term = $wp_query->queried_object;
$getterm = $term->slug; // get current slug (E.g. activity_running)
$posts = get_posts(array(
"post_type" => "posttype",
'tax_query' => array(
array(
'taxonomy' => 'taxonomies,
'field' => 'slug',
'terms' => $getterm,
'include_children' => true,
'operator' => 'IN'
),
),
"numberposts" => "-1",
'post_status' => 'publish',
'order' => 'DESC',
));
?>
<?php
foreach ($posts as $post){
setup_postdata($post);
?>
html
<?php
}
wp_reset_postdata();
?>
$more = 1;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
</body>
</html>
</body>
" далее поднимаемся на одну строчку выше и пишем следующее:<script src="main.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script src="main.js"></script>
</body>
</html>