Wordpress查询自定义帖子类型的新添加

时间:2018-09-13 16:02:39

标签: php wordpress

如果要在wordpress admin中添加新的帖子类型,我想在php变量中获取布尔值(真/假)。

现在我有了这段代码

<?php

    $popularpost = new WP_Query( array('post_type' => 'product','date_query' => array( array( 'after' => '-3days' ) )  ) );
    $v=1; while ( $popularpost->have_posts() ) : $popularpost->the_post();
        if($v >=1){

        $_SESSION["newproduct"] = "newproduct";

    ?>
            <script>
                $( ".shop > a" ).after( "<span>New</span>" );
            </script>

        <?php  }  ?>


<?php   $v++; endwhile; wp_reset_query(); ?>

0 个答案:

没有答案