Advertisement
Guest User

Untitled

a guest
Oct 15th, 2013
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. function latest_2_posts_func($atts) {
  2.     ?>
  3.    
  4.     <section id="latest-blog-posts">
  5.         <h2>Latest blog posts</h2>
  6.         <div id="blog-posts-container">
  7.         <?php
  8.         $args = array( 'numberposts' => '2', 'category' => '-'.get_cat_ID("Projects"));
  9.         $recent_posts = wp_get_recent_posts( $args );
  10.         foreach( $recent_posts as $recent ){
  11.         ?>
  12.        
  13.         <article class="blog-post">
  14.             <h3><a href="<?php echo get_permalink($recent["ID"]); ?>" title="<?php echo $recent["post_title"]; ?>">
  15.             <?php echo $recent["post_title"]; ?></a></h3>
  16.             <p><?php echo $recent["post_content"]; ?></p>
  17.         </article>
  18.         <?php } ?>
  19.             </div>
  20.             <a href="blog" class="btn icon-chevron-right">Visit our blog</a>
  21.         </section>
  22.         <!-- latest blog posts end -->
  23.     <?php
  24. }
  25.  
  26. add_shortcode( 'latest_2_posts', 'latest_2_posts_func' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement