Hi all,
in my quest to create self-contained themes, I discovered the functions.php and it's possibilities.
So I basically took my own plugin that extracts post images and used it in a client's functions.php.
Now I've done this before, but on my newest client's server I got empty pages permanently. The site would just show me an empty page, no source code. ALso, the admin was screwed up.
Debugging showed that it's not a plugin incompatibility, but the functions.php that screws things up.
But only on that server.
Anyone know why this happens? Is there something I need to consider when using functions.php? All I used was this:
function postheader() {
$images = get_children(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => '-1',
'order' => 'DESC',
'orderby' => 'ID',
'post_mime_type' => 'image'));
if ( $images )
{
foreach( $images as $image ) {
$attachmenturl=wp_get_attachment_url($image->ID);
$attachmentimage=wp_get_attachment_image($image->ID, 'full' );
$img_title = $image->post_title;
if (stristr($img_title, '[header]')){
echo "<img src=$attachmenturl>";
}
}
} else {
echo '<img src="/wp-content/uploads/header_start.jpg">';
}
}
I'd appreciate some pointers. Should I try to use plugins rather than a functions.php?