从主循环wordpress中排除自定义帖子类型

我正在使用wordpress并设置了一些自定义帖子类型。我需要知道如何从主外观中排除这些内容, 以便”自定义帖子类型”不会显示在博客中。


#1


只需将’post_type’=>’home-post’替换为’post_type’=>’post’或删除该行, 它只会提取你的常规帖子


#2


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;?>

来源:

https://www.srcmini02.com/66989.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_40259.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?