<?php

/**
 * Returns 'blog' post type 
 *
 * This function returns the built in posts type which
 * is used for the blog posts. The posts are returned
 * with a post title and post excerpt, with the title
 * being a link to the post single page.
 *
 * @function add_blog()
 *
 * @uses WP_Query::the_post()
 *
 * @param N/A
 *
 * @return (string) The blog posts title and excerpt
 *
 * @since 1.1.0 
 *
 */
function add_blog() {

    $query = new WP_Query( array(
		'post_type' => 'post',
    ) );
	$string = '';
	
	if ( $query->have_posts() ) {
		
		while ( $query->have_posts() ) {
			
			$query->the_post();
			$string .= '<article>';
			$string .= '<h3><a href="' . get_the_permalink() . '">' . get_the_title() . '</a></h3>';
			$string .= get_the_excerpt();
			$string .= '</article>';
		}
	}
	wp_reset_postdata();
	return $string;
}
add_shortcode( 'blog', 'add_blog' );