• I have a shortcode [user-profile] where the author ID is the attribute. I’d like to make it so that if no ID is specified [user-profile] defaults to post author, and when an ID is specified, like [user-profile id="47"], it uses that ID. The shortcode function right now is like this:

    function user_profile( $atts, $content = null ) {
    	extract(shortcode_atts(array('id' => ''), $atts));
    	include ('user-profile.php');
    	return $user_hcard;
    	}

    …which works only when an ID is specified.
    (user-profile.php code is here)
    How can I set the default to be the $post->ID ?

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘shortcode attribute default value post->ID’ is closed to new replies.