最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Query for current post

programmeradmin2浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 0

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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论