How To show custom post and Custom post field data in WordPress

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

how to fetch custom post and custom post field data in WordPress.

<?php
 $type = 'unlimited';
 $args=array(
  'post_type' => $type,
  'post_status' => 'publish',
  'posts_per_page' => -1,
  'caller_get_posts'=> 1
 );
 $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);
 #print_r($meta);
 ?>
 <div class="main">
  <div class="view view-eighth">
   <div class="image-top1 col-md-2">
    <img src="<?php the_post_thumbnail_url('full'); ?>" class="b-lazy img-responsive wp-post-image lazy-hidden" alt="no thumb">
   </div>
   <div class="mask col-md-10">
    <h2><?php the_title(); ?></h2>
    <h2><?php the_content(); ?></h2>
    <a href="<?php echo get_permalink( $post->ID ); ?>" class="inline info">Read More</a>
   </div>
  </div>
 </div>
 <?php
  endwhile;
  wp_reset_query();
 }

 ?>
Learn Tutorials Point
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.