In a post, I have this text:
[bhours shortcode="test" title="test"]
But the "title" attribute appears to be ignored. Here's a var_dump of the $atts attribute array
array(1) {
["shortcode"]=>
string(4) "test"
}
Here's the PHP code:
function bhour_shortcode_handler($atts){
global $post,$bhourdays;
$output='';
echo var_dump($atts);
if(isset($atts['shortcode']) && !empty($atts['shortcode'])){
if(isset($atts['title']) && empty($atts['title'])){
$output.='';
}
elseif(isset($atts['title']) && !empty($atts['title'])){
$output.='<h3>'.$atts['title'].'</h3>';
}
else{
//get title from post
}
}
$output.='<p>this is a test</p>';
return $output;
}
add_shortcode('bhours', 'bhour_shortcode_handler');
Is the "title" attribute some sort of reserved word?