Hi, I’m using WordPress 4.5.1 and want to display custom post type (product) but it’s not showing the single-product page instead returns index.
My index
<?php $args = array('post_type'=>'my_product','posts_per_page'=>1);
$product = new WP_Query($args);
if($product->have_posts()): while($product->have_posts()): $product->the_post(); ?>
<div class="media">
<div class="col-sm-12 col-lg-7 arr">
<div class="media-body" style="padding-right: 20%;">
<h4 class="media-heading">
<?php the_title();?>
</h4>
<hr class="gold-hr">
<p>
<?php the_excerpt();?>
</p>
<a href="<?php the_permalink();?>"><b>????? ??????</b> <i class="fa fa-chevron-left"></i></a>
</div>
</div>
my single-product:
<div class=”panel”>
<div class=”panel-heading”><h4><?php the_title();?> </h4></div>
<div class=”panel-body”>
<?php if (have_posts()): while(have_posts()): the_post(); ?>
<div class=”thumbnail”>
<?php if(has_post_thumbnail()) { the_post_thumbnail(‘featured’); }?>
<div class=”caption”>
<h3><?php the_title();?></h3>
<p class=”text-muted”>???????: <?php the_author();?> ?? ?? ?????: <?php the_date();?></p>
<p> <?php the_content();?> </p>
</div>
</div>
<?php endwhile; endif; ?>
</div>
</div>
any help.
thanks.