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