Support » Plugins » functions.php vs plugin

  • mores


    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 ) {
    			$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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • jessai


    If you have the problem just on this server.

    try to put absolute way for source image.



    🙂 I removed the absolute link as to not publish the domain in question 🙂

    Uhm, it’s not an image problem, it’s the whole page that does not show up. Just blank page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘functions.php vs plugin’ is closed to new replies.