Latest Post

How To show custom post data in categories in Wordpress

How To show custom post data in categories in Wordpress

How To show custom post data in categories in Wordpress


This code is use for you are create custom post than after you are get this data for specific categories than this code working perfect.

$args=array(
'post_type' => 'unlimited',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => array(
array(
  'taxonomy' => 'taxonomy name',
  'field' => 'slug',
  'terms' => 'categories name',
)
  )
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts()) {
while ($my_query->have_posts()) : $my_query->the_post();
$meta=get_post_meta($my_query->post->ID);
?>

<div class="home-auto-part-title">
<p><?php the_title(); ?></p>
</div>
<?php
endwhile;

}

No comments