我正在使用wordpress并设置了几个自定义帖子类型 . 我需要知道如何从主要外观中排除这些,因此自定义帖子类型不会显示在博客中 .
只需用'post_type'=>'post'替换'post_type'=>'home-post'或删除该行,它只会拉你的常规帖子
this code use for fetch post type data <?php $args = array('post_type' => 'post','posts_per_page' => -1); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <h1 class="entry-title"><?php the_title(); ?></h1> <div class="entry-content"> <?php the_content(); ?> </div> <?php endwhile;?>
2 回答
只需用'post_type'=>'post'替换'post_type'=>'home-post'或删除该行,它只会拉你的常规帖子