用于自定义帖子类型don'的单个模板;在WordPress中不显示单个帖子
我在一个mycustompost.php文件中的WordPress代码有问题 这是我的代码:用于自定义帖子类型don'的单个模板;在WordPress中不显示单个帖子,wordpress,custom-post-type,Wordpress,Custom Post Type,我在一个mycustompost.php文件中的WordPress代码有问题 这是我的代码: <div id="contenu"> <?php global $post;?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post();?> &l
<div id="contenu">
<?php global $post;?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post();?>
<div id="main-inner">
<?php
$terms = get_the_terms( $post->ID, 'projet');
?> <div id="img-slide">
<div id="img-slide-large">
<?php
$args = array(
'order' => 'ASC',
'post_type' => 'attachment',
'post_parent' => $post->ID,
'post_mime_type' => 'image',
'post_status' => null,
'orderby' => 'menu_order',
'numberposts' => -1,
);
$attachments = get_posts( $args );
if ($attachments) {
foreach ($attachments as $attachment) {
$attachment_url = wp_get_attachment_url( $attachment->ID , 'full' );
$image = aq_resize( $attachment_url, 758, 398, true ); //resize & retain image proportions (soft crop)
echo '<img src="' . $image . '"/>';
}
}
?>
</div>
<div id="img-slide-thumb">
<ul id="nav-thumb">
<?php
if ($attachments) {
foreach ($attachments as $attachment) {
$attachment_url = wp_get_attachment_url( $attachment->ID , 'full' );
$image = aq_resize( $attachment_url, 129, 85, true); //resize & retain image proportions (soft crop)
?>
<li><a href="#"><?php echo '<img src="' . $image . '"/>'; ?></a> </li>
<?php
}
} ?>
</ul>
</div>
</div>
<div id="infos">
<?php echo esc_html( get_post_meta( get_the_ID(), 'date_create_post_type', true ) ); ?>
<h2><?php the_title() ?></h2>
<h3><?php echo esc_html( get_post_meta( get_the_ID(), 'soustitre_create_post_type', true ) ); ?></h3>
<p><?php the_content(); ?></p>
</div>
<?php endwhile;
endif;
?>
</div>
但它显示了我在PROJET海关的全部名单。我不知道它为什么会这样;你能帮我吗?问题解决了!
我忘了在标题中有一个查询没有
所以我在标题中添加了soooo,它解决了这个问题。
! 使用您的单一文件名single-projet.phpi allready使用它!我粘贴代码