Advertisement
hmbashar

WordPress Custom Post Query

May 24th, 2015
568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. <?php
  2. $blog_post_query = new WP_Query(array(
  3.     'post_type' => 'blog-post'
  4. )); ?>
  5. <?php if($blog_post_query->have_posts()) : $i = 0;?><?php while($blog_post_query->have_posts()) : $blog_post_query->the_post(); $i++;?>  
  6.  
  7. <div class="blog_single_post">
  8.     <h1><?php the_title();?></h1>                          
  9.     <div class="blog_post_info_index">
  10.         <p>By Writer   |   <i class="fa fa-eye"></i> <?php if(function_exists('the_views')) { the_views(); } ?> |  <i class="fa fa-calendar"></i> Date: <?php the_time('j/m/Y'); ?> | <i class="fa fa-clock-o"> Time: <?php the_time('g:iA'); ?></i> | <i class="fa fa-thumb-tack"></i> Category: <?php the_blog_cat(); ?> | <i class="fa fa-edit"></i> <?php edit_post_link( __( 'Edit' )); ?> </p>
  11.     </div>
  12.     <div class="blog_post_index">
  13.         <div class="blog_post_feature">
  14.             <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('blog_post_img'); ?></a>  
  15.         </div>
  16.         <div class="blog_single_post_content">
  17.             <p><?php echo excerpt(40); ?></p>
  18.         </div>
  19.         <div class="blog_single_post_readmore">
  20.             <a href="<?php the_permalink();?>">Read More</a>
  21.         </div>
  22.     </div>                             
  23. </div>
  24.  
  25. <?php endwhile;?>
  26. <?php endif ;?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement