Hi,
I've written my very first function - and shortcode - more or less from scratch, and it almost works perfectly (for what I want, I mean):
codefunction get_the_person($atts, $content=null) {
extract(shortcode_atts(array(
'pid' => 0, 'align' => 'left'
), $atts));
/* global $post; */
$address = get_bloginfo("template_url");
$person_id = get_post($pid);
$ret='<div id="person-'.$person_id->ID.'" class="person">';
$ret.='<p> post_name.'" rel="bookmark" title="'.$person_id ->post_title.'">';
if(has_post_thumbnail()) {
$pid_image = get_the_post_thumbnail( $person_id->ID, 'thumbnail', array( 'class' => 'index-post-thm border person-align-'.$align.'', alt => 'Alt text' ) );
} else { $pid_image='<img src="'.$address.'/images/img-default.jpg" class="index-post-thm border" alt="blank" />' ; }
$ret.= $pid_image; $ret.= $person_id -> post_title.'<!-- br / -->'.$person_id -> post_excerpt.'</p></div>';
return $ret;
}/code
Sorry about the ugliness of the code. I'm new to it.
Anyway, there are two problems which have got me stumped. Firstly, even though I've removed wpautop, that $person_id -> post_excerpt bit is still wrapped in unwanted p tags. Grr.
Secondly; if there is no thumbnail associated with the called post, then the img tag is ignored, even though I set the variable to something to cope with such events. It's not that there's an image error in the browser; the image tag is completely left out.
What am I doing wrong?
Gary