Wordpress get_发布自定义类别
你们能帮我一下吗,我正在试着只过滤我的post循环中的夜生活事件代码Wordpress get_发布自定义类别,wordpress,loops,post,get,Wordpress,Loops,Post,Get,你们能帮我一下吗,我正在试着只过滤我的post循环中的夜生活事件代码 var locations = [<?php $posts = get_posts(array( 'posts_per_page' => -1, 'post_type' => 'post', 'category' => 'nightlife' )); if( $posts ): ?> <?php forea
var locations = [<?php
$posts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'post',
'category' => 'nightlife'
));
if( $posts ): ?>
<?php foreach( $posts as $post ):
setup_postdata( $post );
?> {
lat: <?php the_field('lattitude'); ?>,
lng: <?php the_field('longitude'); ?>,
info: '<div class="onMapSingleWrapper"><h1 class="onMapTitle"><?php the_title(); ?></h1><p class="onMapDate"><?php the_field('date_de_levenement'); ?></p><p class="onMapPrice"><?php the_field('prix_de_levenement'); ?>$</p><p class="onMapFilter"><?php the_field('filtres'); ?></p></div>'
},
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
];
google.maps.event.addDomListener(window, "load", initMap);
var位置=[
{
拉丁语:,
液化天然气:,
信息:'$
'
},
];
google.maps.event.addDomListener(窗口“加载”,initMap);
我总是得到我所有的帖子,我只想要夜生活类的帖子
谢谢我终于拿到了,如果有人需要,就在这里
$catSelect = '';
$posts = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'post',
'category_name' => $catSelect
));
if( $posts ): ?>
<?php foreach( $posts as $post ):
setup_postdata( $post );
?> {
lat: <?php the_field('lattitude'); ?>,
lng: <?php the_field('longitude'); ?>,
info: '<div class="onMapSingleWrapper"><h1 class="onMapTitle"><?php the_title(); ?></h1><p class="onMapDate"><?php the_field('date_de_levenement'); ?></p><p class="onMapPrice"><?php the_field('prix_de_levenement'); ?>$</p><p class="onMapFilter"><?php the_field('filtres'); ?></p></div>'
},
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
];
google.maps.event.addDomListener(window, "load", initMap);
$catSelect='';
$posts=获取_posts(数组(
“每页帖子数”=>-1,
“post_type”=>“post”,
“类别名称”=>$catSelect
));
如果($员额):?>
{
拉丁语:,
液化天然气:,
信息:'$
'
},
];
google.maps.event.addDomListener(窗口“加载”,initMap);