• Here’s the notices:

    PHP Notice: Trying to get property ‘post_type’ of non-object in /app/wordpress/wp-content/plugins/cool-timeline/includes/shortcodes/story-timeline/cool-timeline-shortcode.php on line 44

    PHP Notice: Trying to get property ‘post_type’ of non-object in /app/wordpress/wp-content/plugins/cool-timeline/includes/shortcodes/story-timeline/cool-timeline-shortcode.php on line 30

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @marcelo2605,

    Please let us know exactly where you are getting these error messages, so that we may check the same case.

    Also let us know the version number of your installed Cool Timeline plugin.

    Thanks

    Thread Starter marcelo2605

    (@marcelo2605)

    @baljitdhanjal The notice is thrown when I run this line on my code:

    apply_filters('get_the_excerpt', $post_object->post_excerpt, $post_object);

    Investigating the plugin code (I’m using version 2.0.4), I found the functions ctl_excerpt_more and ctl_excerpt_length that get post_type from global $post.

    But sometimes, the global $post are empty. So maybe you can change this:

    if ($post->post_type == 'cool_timeline' && !is_single() ){

    for this:

    if ($post && $post->post_type == 'cool_timeline' && !is_single() ){

    in both functions.

    This changes remove the notice for me.

    • This reply was modified 4 years, 4 months ago by marcelo2605.

    Hi @marcelo2605,

    Thansk for sharing details.

    We will surely update this code in our plugin’s upcoming version.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plugin is throwing a PHP Notice when open archive template from another CPT’ is closed to new replies.