0

我在单个 mycustompost.php 文件中的 WordPress 代码有问题。

这是我的代码:

       <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 海关职位的完整列表。我不知道为什么会这样;你可以帮帮我吗?

4

1 回答 1

0

问题解决了 !我忘记了我在标题中有一个查询,但我在标题中添加了它,它解决了问题。!

于 2013-05-17T07:50:52.570 回答