admin管理员组文章数量:1387324
I want to show current post.I will use this query in single template for custom post type.When click the custom post type, only the post will shown.
How can I write this query?
In wordpress developer page, $post exists as a query arg.But there is no how to use $post arg.
I write this : $post=get_post(); but it didnt work.How can I write $post as a arg in query array?
I want to show current post.I will use this query in single template for custom post type.When click the custom post type, only the post will shown.
How can I write this query?
In wordpress developer page, $post exists as a query arg.But there is no how to use $post arg.
I write this : $post=get_post(); but it didnt work.How can I write $post as a arg in query array?
Share Improve this question asked May 3, 2020 at 5:21 ahmet kayaahmet kaya 331 silver badge9 bronze badges1 Answer
Reset to default 0You shouldn't be writing any query. WordPress does this for you. You single-{post type}.php
template should only contain the standard loop:
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
// Display post content
endwhile;
endif;
?>
本文标签: Query for current post
版权声明:本文标题:Query for current post 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744509101a2609769.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论