• Resolved baszer

    (@baszer)


    Hello,

    when I search for something on my theme and there are no results I get the following error:

    Notice: Trying to get property of non-object in /var/www/vhosts/eenwebsitevanbas.nl/subdomains/test/httpdocs/wp-
    content/themes/bbiotodoma/functions.php on line 101

    the code in line 101 is:
    foreach((get_the_category($post->ID)) as $category)
    what can I do to resolve this error?

Viewing 5 replies - 1 through 5 (of 5 total)
  • foreach( get_the_category($post->ID) as $category ) ??

    Thread Starter baszer

    (@baszer)

    hmmm…

    doesnt work, more suggestions? ??

    Thread Starter baszer

    (@baszer)

    do you know what the following code does?

    function category_id_class($classes) {
    		global $post;
    		foreach((get_the_category($post->ID)) as $category)
    			$classes [] = 'cat-' . $category->cat_ID . '-id';
    			return $classes;
    	}
    	add_filter('post_class', 'category_id_class');
    	add_filter('body_class', 'category_id_class');

    because i deleted it, and it still works fine, and the error is gone!

    It appears to be trying to add category-id-specific classes to both the body_class() and post_class() functions. However, these are added by default in WordPress 3.x, so I can only assume that this is a pre-3.x theme.

    Thread Starter baszer

    (@baszer)

    thanks esmi,

    now they are deleted! ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Error non-property in line’ is closed to new replies.