About the annoying php debug notice when
global $post; is used:
Notice: Trying to get property of non-object ... eval()'d code in line ...
As explained on Other Notes page of Widget Logic plugin, it is possible to access
$post by using e.g.
global $post; return (is_page('home') || ($post->post_parent=="13"));
This example causes the above explained error under certain conditions.
Another shorter example which also can trigger the error:
global $post; return ( $post->post_name == 'test' );
To avoid the error, you simply have to check if
$post is available before accessing its properties:
Fixed example, with an extra check, no more php debug notice:
global $post; return ( !empty( $post ) && $post->post_name == 'test' );
eval() is called two times by WordPress, first time when a
$post is not yet there and a second time when the widget is finally displayed in sidebar etc.
Suggested fix: Include this information in Widget Logic documentation.
Thanks for this great plugin.