Invalid Argument on line 404
-
Hello getting these errors on my site:
Warning: Invalid argument supplied for foreach() in /path/reviews/wp-includes/template-functions-category.php on line 400
Warning: in_array(): Wrong datatype for second argument in /path/reviews/wp-includes/template-functions-category.php on line 404
I’m using the custom posts plugins by Ryan. Heres’ the code for the file:
<?php
/*
Plugin Name: Custom Post Templates
Plugin URI: https://boren.nu/
Description: Load custom single post templates.
Author: Ryan Boren
Version: 0.9
Author URI: https://boren.nu/
*/function cpt_custom_post_template($template) {
global $wp_query;$post = $wp_query->post;
$id = $post->ID;// If a template exists for this post ID, load it.
if ( file_exists(TEMPLATEPATH . "/single-{$id}.php") )
return TEMPLATEPATH . "/single-{$id}.php";// Add custom checks here. For example, give posts different templates
// depending on what categories they are in.
//if ( in_category('1') && file_exists(TEMPLATEPATH . '/single-cat-1.php') )
// return TEMPLATEPATH . '/single-cat-1.php';if ( in_category('2') && file_exists(TEMPLATEPATH . '/single-cat-2.php') )
return TEMPLATEPATH . '/single-cat-2.php';if ( in_category('3') && file_exists(TEMPLATEPATH . '/single-cat-3.php') )
return TEMPLATEPATH . '/single-cat-3.php';if ( in_category('4') && file_exists(TEMPLATEPATH . '/single-cat-4.php') )
return TEMPLATEPATH . '/single-cat-4.php';if ( in_category('5') && file_exists(TEMPLATEPATH . '/single-cat-5.php') )
return TEMPLATEPATH . '/single-cat-5.php';
}add_filter('single_template', 'cpt_custom_post_template');
?>What have I done wrong here? I’ll be honest all I did was copy the category template and rename it single-cat-x.php for each cat as it contained the same style I wanted.
Thanks in advance
- The topic ‘Invalid Argument on line 404’ is closed to new replies.