Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Something is wrong with my wp-admin page, it just shows up blank. I am pretty sure it has to do with my function.php file there is no whitespace on the top or bottom, but when I delete it completely, the wp-admin folder works again.

here is the functions.php file

<?php

add_action("manage_posts_custom_column",  "booktime_custom_columns");
add_filter("manage_edit-booktime_columns", "booktime_edit_columns");

function booktime_custom_columns($column){
    global $post;

    switch ($column) {
        case "name":
            the_excerpt();
        break;
        case "address":
            $custom = get_post_custom();
            echo $custom["address"][0];
        break;
        case "phone":
            $custom = get_post_custom();
            echo $custom["phone"][0];
        break;
        case "date":
            $custom = get_post_custom();
            echo $custom["date"][0];
        break;
        case "bottles":
            $custom = get_post_custom();
            echo $custom["bottles"][0];
        break;

    }
}

function booktime_edit_columns($columns){
    $columns = array(
        "cb" => "<input type=\"checkbox\" />",
        "title" => "Post should show",
        "description" => "name",
        "address" => "address",
        "phone" => "phone",
        "date" => "date",
        "bottles" => "bottles"
    );

    return $columns;
}

?>

<?php
add_action("admin_init", "admin_init_booktime");

function admin_init_booktime(){

    add_meta_box("name", "name", "name", "booktime", "normal", "low");

}
?>

<?php
function name() {
    global $post;
    $custom = get_post_custom($post->ID);
    $name = ( !empty($custom["name"][0]) ) ? $custom["name"][0]: "";
    ?>
    <p><label>Name:</label><br />
        <input type="text" name="name" value="<?php echo $name; ?>"/></p>
    <?php
}
?>

<?php
add_action('save_post', 'save_details_booktime');

function save_details_booktime(){
    global $post;
    $custom_meta_fields = array( 'name' );

    foreach( $custom_meta_fields as $custom_meta_field ):
        if(isset($_POST[$custom_meta_field]) && $_POST[$custom_meta_field] != ""):
            update_post_meta($post->ID, $custom_meta_field, $_POST[$custom_meta_field]);
        endif;
    endforeach;

}
?>

EDIT: I turned wp-config debug on and I get the following

Parse error: syntax error, unexpected '<' in /Users/anderskitson/Sites/fiftyfity/wp-content/themes/fiftyfityNew/functions.php on line 61
share|improve this question
    
This piece of code was in there at line 61 for some reason and it was causing the error. <p><label>Name:</label><br /> <input type="text" name="name" value="<?php echo $name; ?>"/></p> –  Anders Kitson Jan 25 '12 at 20:23
add comment

5 Answers

Have you tried changing your function names? The main one that would concern me as potentially having overlap is name(). If I'm doing a theme for myself, usually I'll use my_ as the prefix for everything, otherwise I'll use a unique identifier based on the name of the theme.

share|improve this answer
    
I replaced all instances of name with my_name and still the same issue. –  Anders Kitson Jan 25 '12 at 19:13
    
In addition to removing all but the opening and closing PHP tags? Why do you have more than one, btw? –  m0r7if3r Jan 25 '12 at 19:28
    
I got this code from another source and modified it for myself. That's how it was already. –  Anders Kitson Jan 25 '12 at 19:42
    
Alright, well it's important when you do that that you understand the code. The <?php and ?> are basically just telling the server to parse that with the PHP parser and not to output it as HTML. If you turn WP_DEBUG on, do you get any sort of error? –  m0r7if3r Jan 25 '12 at 19:44
    
wp-config.php is where WP_DEBUG is typically set. Try to google for your answers before you ask please, I don't want this flagged for too many comments. –  m0r7if3r Jan 25 '12 at 19:57
add comment

You need to remove spaces between all closing/opening PHP tags, including:

}
?>

<?php
add_action('save_post', 'save_details_booktime');

and

}
?>

<?php
function name() {

and

}

?>

<?php
add_action("admin_init", "admin_init_booktime");

(Check your file; might not be all-inclusive.)

Edit

In addition to @m0r7if3r's great answer, I would suggest the following as a means of trouble-shooting:

  1. Remove everything from functions.php
  2. Add a single, opening <?php tag. Do not add a closing tag
  3. Add in each of your functions, one at a time, until you find one that causes the site to WSOD.
  4. Fix the issue with that function
  5. Continue with each remaining function, one at a time, until you have restored all of your functions.
share|improve this answer
    
I actually got rid of all the php files in between and wrapped it all in on php tag, but it still does the same thing. –  Anders Kitson Jan 25 '12 at 18:34
    
Then you're going to need to troubleshoot, function by function. See updated answer. –  Chip Bennett Jan 25 '12 at 20:04
add comment
up vote 1 down vote accepted

I turned wp-config debug on, and found the bug. This piece of code was in there at line 61 for some reason and it was causing the error. <p><label>Name:</label><br /> <input type="text" name="name" value="<?php echo $name; ?>"/></p>

share|improve this answer
add comment

I'd simply remove ALL the tags but the first and last one

share|improve this answer
    
I just tried that, and it doesn't seem to work still. –  Anders Kitson Jan 25 '12 at 18:42
add comment

To all the folks who get this kind of error a must check option. turn on error reporting if you have commented the lines in your wp-config.php

@ini_set('display_errors','Off');

and than check for error. if it has the error like this

PHP Warning: Cannot modify header information - headers already sent by (output started at /[server info]/wp-config.php:77)

than check your wp-config.php for extra space at top and bottom of the page.remove extra line spaces even. and than re-upload the wp-config.php. Most of time this will solve your problem.

Happy Coding!!!!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.