Reputation: 143
I've got 2 super specific 'missing argument 2' errors going on. In localhost it's all good, but once I've put the whole thing online it's returning these errors:
A) Warning: Missing argument 2 for add_category_to_single() in /home/content/23/9090823/html/extranet/printedcrush/wp-content/themes/facepress/functions.php on line 89
Code:
add_filter('body_class','add_category_to_single');
(line 89) function add_category_to_single($classes, $class) {
if (is_single() ) {
global $post;
foreach((get_the_category($post->ID)) as $category) {
$classes[] = $category->category_nicename;
}
}
return $classes;
}
B) Warning: Missing argument 2 for my_class_names() in /home/content/23/9090823/html/extranet/printedcrush/wp-content/themes/facepress/functions.php on line 100
Code:
add_filter('body_class','my_class_names');
(line 100) function my_class_names($classes, $class) {
if (is_single() ) {
global $post;
foreach((get_the_category($post->ID)) as $category) {
$classes[] = $category->category_nicename;
}
}
if (! ( is_user_logged_in() ) ) {
$classes[] = 'logged-out';
}
return $classes;
}
Does anybody know how could I have these errors fixed? Thanks in advance. :)
Upvotes: 2
Views: 1671
Reputation: 6828
The body_class
filter hook accepts one single parameter, the array of classes to be modified, e.g.:
add_filter( 'body_class', 'so29108478_body_class' );
function so29108478_body_class( $classes ) {
$classes[] = 'my-class';
return $classes;
}
http://codex.wordpress.org/Plugin_API/Filter_Reference/body_class
Upvotes: 2