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?

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; 
?>
| improve this answer | |
  • One plugin's shortcode with php command doesnt work in single-html5blank.php while it works on posts and pages.Can I fix it for my theme? What kind of thing cause this if there is no command to avoid this in plugin? – ahmet kaya May 3 at 6:38
  • I added content function then it works now.Thank you also your answer – ahmet kaya May 3 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.