Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function latest_2_posts_func($atts) {
- ?>
- <section id="latest-blog-posts">
- <h2>Latest blog posts</h2>
- <div id="blog-posts-container">
- <?php
- $args = array( 'numberposts' => '2', 'category' => '-'.get_cat_ID("Projects"));
- $recent_posts = wp_get_recent_posts( $args );
- foreach( $recent_posts as $recent ){
- ?>
- <article class="blog-post">
- <h3><a href="<?php echo get_permalink($recent["ID"]); ?>" title="<?php echo $recent["post_title"]; ?>">
- <?php echo $recent["post_title"]; ?></a></h3>
- <p><?php echo $recent["post_content"]; ?></p>
- </article>
- <?php } ?>
- </div>
- <a href="blog" class="btn icon-chevron-right">Visit our blog</a>
- </section>
- <!-- latest blog posts end -->
- <?php
- }
- add_shortcode( 'latest_2_posts', 'latest_2_posts_func' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement