eddiemachado/bones-responsive — Issue #8: bones_get_socialimage()
Author: humanshell
Created: 2011-12-10 03:15:37+00:00
State: open

Eddie,

It's been a while since I'd looked at bones and as soon as I saw you came out with a responsive version I had to check it out.

Just wanted to give you a heads up on an issue I came across with the bones_get_socialimage() function in plugins.php. With WP_DEBUG set to true I get a bunch of errors with the $post variable starting on line 31 of that function. I've been able to get most to go away by moving the `global` call from the else statement to the top of the function body:

```php
function bones_get_socialimage() {
global $post, $posts;
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), '', '' );
if ( has_post_thumbnail($post->ID) ) {
$socialimg = $src[0];
} else {
$socialimg = '';
$output = preg_match_all('//i',
$post->post_content, $matches);
$socialimg = $matches[1][0];
}
if(empty($socialimg)) {
$socialimg = get_template_directory_uri() . '/library/images/nothumb.gif';
}
return $socialimg;
}
```

But I can't seem to get the last error to go away. This is the error:

Notice: Undefined offset: 0 in /Users/humanshell/Sites/wordpress/humanshell/wordpress/wp-content/themes/bones/library/plugins.php on line 39

That offset is referring to the two-dimentional $matches array, where does that variable come from? I don't see it defined anywhere and putting it in the call global doesn't help.

Dom