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
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.You need to remove spaces between all closing/opening PHP tags, including:
and
and
(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:
functions.php
<?php
tag. Do not add a closing tagI 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>
I’d simply remove ALL the tags but the first and last one
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
and than check for error.
if it has the error like this
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 thewp-config.php
.Most of time this will solve your problem.
Happy Coding!!!!