I am new in WordPress. I have registered wp_query
function through ‘custom post type UI’ and ‘Advanced custom fields’ plugin. And this is the code in the portfolio page.
<div id="tf-content">
<div class="container"><!-- Container -->
<div class="row"><!-- Row -->
<?php
$args = array(
'post-type' => 'portfolio'
);
$query = new WP_Query( $args );
?>
<?php if($query -> have_posts() ) : while( $query -> have_posts() ) : $query -> the_post(); ?>
<a href= "<?php the_permalink(); ?>">
<div class="col-md-4 col-sm-12 col-lg-3 col-xl-2">
<div class="post-block" style= "margin: 0;"> <!-- Post #1-->
<div class="post-detail" style= "padding: 0;">
<div class="img-wrap">
<?php the_post_thumbnail(); ?>
</div>
</div>
</div>
</div>
</a>
<?php endwhile; endif; wp_reset_postdata(); ?>
</div><!-- end Row -->
</div><!-- End Container -->
I want this code to query all the ‘portfolio’ type custom post but I don’t know why this code queries with general post but not portfolio type post. Please give me a solution for this.
Thank you in advance.