'', 'author_name' => '', 'cat_id' => '', 'cat_slug' => '', 'post_order' => '', 'post_orderby' => '', 'post_type' => 'post', 'search' => '', 'per_page' => '', 'page' => '', ), $atts ); $vars = ''; foreach ($a as $key => $value) { // IF NOT EMPTY ADD TO VAR STRING if($value != '') { $ngAtt = str_replace('_', '-', $key); $vars .= $ngAtt.'="'.$value.'" '; } } ob_start(); // ANGULARJS DIRECTIVE OUTPUT WITH VARS (IF DEFINED) echo ''; return ob_get_clean(); } add_shortcode( 'ng-posts', 'ngPosts' ); function ngPost( $atts ) { $a = shortcode_atts( array( 'post_id' => '' ), $atts ); ob_start(); if($a['post_id'] == ''){ echo '

post_id must be set in shortcode to display content

'; } else { echo ''; } return ob_get_clean(); } add_shortcode( 'ng-post', 'ngPost' ); ?>