Trying to load category thumbnails on wordpress page
<p>I'm trying to show some Wordpress category thumbnails on my homepage, but it seems my code is breaking the rest of my site. It kills the page and anything under my code won't load.</p>

<p>Any help would be appreciated on how to get this working.</p>

<p>Thanks!</p>

<pre><code>&lt;?php

    global $post;
    $temp_post = $post;
    $args = array('numberposts' =&gt; 1, 'category' =&gt; 40, 'orderby' =&gt; 'date', 'order' =&gt; 'DESC');
    $posts = get_posts($args);
    foreach ($posts as $post) : setup_postdata($post);
    if (has_post_thumbnail()) {
        $thumbnail = get_post_thumbnail($post-&gt;ID, 'thumbnail');
        $title = get_the_title();
        $output = $title . "&lt;br /&gt;" . $thumbnail;
    }
    endforeach;
    $post = $temp_post;
    wp_reset_postdata();
    return($output);

?&gt;
</code></pre>

<p><strong>EDIT</strong></p>

<pre><code>&lt;?php

global $post;
$temp_post = $post;
$args = array('numberposts' =&gt; 6, 'category' =&gt; 227, 'orderby' =&gt; 'date', 'order' =&gt; 'DESC');
echo '&lt;div class="categoryThumbnailList"&gt;';
$posts = get_posts($args);
foreach ($posts as $post) : setup_postdata($post);
if (has_post_thumbnail()) {
    $thumbnail = get_the_post_thumbnail($post-&gt;ID, 'thumbnail');
    $link = get_permalink($post-&gt;ID);
    $title = get_the_title();
    echo '&lt;div class="categoryThumbnailList_item"&gt;';
    echo '&lt;a href="' .$link . '" title="' .$title . '"&gt;' .$thumbnail . '&lt;/a&gt;&lt;br/&gt;';
    echo '&lt;a href="' .$link . '" title="' .$title . '"&gt;' .$title . '&lt;/a&gt;';
    echo '&lt;/div&gt;';
}
endforeach;
echo '&lt;/div&gt;';
echo '&lt;div class="categoryThumbnailList_clearer"&gt;&lt;/div&gt;';
$post = $temp_post;
wp_reset_postdata();
</code></pre>

<p>?></p>
