How To show custom post data in categories in WordPress

How-To-show-custom-post-and-Custom-post-filed-data-in-Wordpress

This code is used for you to create custom posts than after you are getting this data for specific categories than this code working perfectly.

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

  }

?>
We Well organized and easy-to-understand Interactive tutorials With lots of examples of how to use Tutorials WordPress, PHP, Bootstrap, Bootstrap 4, HTML, CSS, AJAX, jQuery, Woocommerce, Post, Database, Javascript, Theme, Responsive, Templates.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact us

Fill in the form below or give us a call and we'll contact you. We endeavour to answer all enquiries within 24 hours on business days.