add_shortcode('stats', 'stats_func'); function stats_func($atts) {
extract( shortcode_atts( array(
'hero' => ''
), $atts ) );
if(strlen($hero) < 1){ return; }
$the_slug = $hero;
$args=array(
'name' => $the_slug,
'post_type' => 'post',
'post_status' => 'publish',
'numberposts' => 1
);
$my_posts = get_posts($args);
if( $my_posts ) {
$HeroPostID = $my_posts[0]->ID;
}
}
//edit That's how i would do it.