WordPress 自定义帖子循环不起作用 - 不显示任何内容
我有一个定制的帖子类型,该类型使用Pods插件创建,标有“ Camere”复数和“ Camera”单数。
我将这个循环放置在页面上,但没有出现。 甚至没有锚标签中的文本。 如果我将帖子类型的名称更改为单数标签,则浏览器在循环之后也不会呈现代码(div“ servizi”),
<section class="small">
<h2>Le Nostre Camere</h2>
<div class="intro">
<?php echo do_shortcode('[pods field="intro_camere"]'); ?>
</div>
<div class="lista_camere">
<div class="lista_camere_item">
<?php
$args = array(
'post_type' => 'Camere',
'posts_per_page' => 3
);
$camere = new WP_Query( $args );
if ( $camere->have_posts() ) :
while ( $camere->have_posts() ) : $camere->the_post(); ?>
<div class="thumb">
<?php the_thumbnail(); ?>
</div>
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>" class="button">Scopri di più</a>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
</div>
</div>
<div class="servizi">
<h2>Servizi</h2>
<div class="lista_servizi">
<?php echo pods_field_display( 'servizio' ); ?>
</div>
</div>
我找不到问题,我的大脑正在融化
I have a custom post type created with Pods plugin labelled "Camere" plural and "Camera" singular.
I placed in my page this loop but nothing shows up.
Not even the the text in the anchor tag.
if I change the name of the post type to the singular label the browser doesn't render also the code after the loop (div "servizi")
<section class="small">
<h2>Le Nostre Camere</h2>
<div class="intro">
<?php echo do_shortcode('[pods field="intro_camere"]'); ?>
</div>
<div class="lista_camere">
<div class="lista_camere_item">
<?php
$args = array(
'post_type' => 'Camere',
'posts_per_page' => 3
);
$camere = new WP_Query( $args );
if ( $camere->have_posts() ) :
while ( $camere->have_posts() ) : $camere->the_post(); ?>
<div class="thumb">
<?php the_thumbnail(); ?>
</div>
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>" class="button">Scopri di più</a>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
</div>
</div>
<div class="servizi">
<h2>Servizi</h2>
<div class="lista_servizi">
<?php echo pods_field_display( 'servizio' ); ?>
</div>
</div>
I can't find what's wrong and my brain is melting lol
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论