shortcode publish blog posts of category

Inside posts [mm-insert-blog catthis=’11’]

function mm_insert_blog_func($atts) {
	extract(shortcode_atts(array('catthis' => ''), $atts));
	$tempCatID ="{$catthis}";
	$argsBlog = array( 'cat'=> $tempCatID ); 
	$output = array();
	$lastposts = get_posts( $argsBlog ); 
foreach($lastposts as $post) : setup_postdata($post); 
	$thistitle = apply_filters('the_title',get_the_title($post));
	$thisdate = apply_filters('the_date',get_the_date($d));
	$output[] = "

".$thistitle."

".$thisdate."
".apply_filters('the_content',get_the_content()); endforeach; $modelPosts = implode('
', $output); return $modelPosts; } add_shortcode('mm-insert-blog', 'mm_insert_blog_func');

http://codex.wordpress.org/Function_Reference/get_the_title
http://codex.wordpress.org/Plugin_API/Filter_Reference

Advertisements