Advertisement
srikat

Untitled

Apr 30th, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <div id="blog-section">
  2.  
  3. <div id="blog-wrap">
  4. <?php
  5. $choice = get_field( 'fp_show_blogs' );
  6.  
  7. if( $choice = 'yes' ) {
  8.  
  9. global $wp_query;
  10.  
  11. $args = array(
  12. // 'post_type' => 'post',
  13. 'posts_per_page' => 6,
  14. );
  15.  
  16. $p_query = new WP_Query( $args );
  17.  
  18. if ( $p_query->have_posts() ) :
  19.  
  20. $i = 0;
  21.  
  22. echo "<ul>";
  23.  
  24. while ( $p_query->have_posts() ) : $p_query->the_post();
  25.  
  26. // $i++;
  27.  
  28. // $pclass = 'one-half';
  29.  
  30. // if ( $i % 2 == 0 ) {
  31.  
  32. // $pclass .= ' first';
  33.  
  34. // }
  35.  
  36. ?>
  37. <li class="one-half <?php if ( ( $i % 2 ) == 0 ) { echo 'first"'; } else { echo '"'; }?>">
  38. <a href="<?php echo the_permalink(); ?>" title="<?php echo the_title(); ?>"><h2><?php echo the_title(); ?></h2></a>
  39. </li>
  40. <?php $i++;
  41. endwhile;
  42.  
  43. echo "</ul>";
  44. endif;
  45. } else {
  46. echo "No Blogs to show!";
  47. }
  48. ?>
  49. </div>
  50.  
  51. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement