开发者

how the loop work in function.php wordpress

     add_action( 'wp_ajax_nopriv_Paper3_submit', 'Paper3_submit' );
        add_action( 'wp_ajax_Paper3_submit', 'Paper3_submit' );    

        function Paper3_submit() {  
     $zxdArgs2 = array(
           'post_type' => 'post',
           'post__in'  => array(3),
        );  
            $zxdQuery = new WP_Query( $zxdArgs2 );
                $zxdQuery->query($zxdArgs2);
                echo 'ok';//this line will show up
                if ($zxdQuery->have_posts()){
                while ($zxdQuery->have_posts()) { 
                $zxdQuery->the_post();
                  echo "002";//never show up
?>
                <li class="zxd_ajax_cc_li><a href="<?php the_permalink();?>" title="Permanent Link To <?php the_title_attribute();?>" ><?php the_title();?></a></li>
                <?php 
                echo "001" ;//never show up
                }
                }
                echo "NO" ;//this line shows up too
                wp_reset_postdata();
               echo 'NO2' ; //this line shows up too
                exit;
            }

i am working on a ajax thing, the functions works,i get the response ,like "okNONO2". but it seems the loop content do no开发者_开发知识库t show,you can see the code above,the "echo" line outside the loop all works,inside ones do not work.how is that?hope someone tell me,thank you.


I know it now,the loop works fine,the psoblem is I use wrong query.that is all.

'category__in'  => array(3),

i want query this.that is why.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜