Support » Plugin: WordPress Share Buttons Plugin – AddThis » PHP Notice: addthis_social_widget.php:1301 Undefined variable: below_excerpt fix

  • Resolved HongPong

    (@hongpong)



    The latest version of the plugin is not causing any visual errors but it is throwing a notice on one of my custom post type templates. I was able to fix this notice by changing line 1300 to

    } elseif ( isset( $below_excerpt ) && $below_excerpt
    [as the $below_excerpt is apparently null and throwing the notice by being uncheckable]. this didn’t seem to effect the area where I do want the buttons to show – not even on the template w the error.

    NOTICE: wp-content/plugins/addthis/addthis_social_widget.php:1301 - Undefined variable: below_excerpt
    require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/mytheme/single-mycustomposttype.php'), the_content, apply_filters('the_content'), call_user_func_array, addthis_display_social_widget

    i used the filter to nix the appearance of this on the custom post type. Notice is not appearing on my other custom post types, BTW i narrowed down their display this way:

    function mytheme_addthis_post_exclude_filter($display)
    {
        //_log('filter fires');
        if ( in_array(get_post_type(), array('project', 'bio','mycustomposttype')) )
            {
                $display = false;
            }
        return $display;
    }
    add_filter('addthis_post_exclude', 'fp_callahan_addthis_post_exclude_filter');

    https://wordpress.org/plugins/addthis/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Also on a search page with no results, this notice occurs :

    Notice: Trying to get property of non-object in /srv/www/callahan/htdocs/wp-content/plugins/addthis/addthis_settings_functions.php on line 430

    That is apparently
    } elseif (is_page($post->ID)) {
    seems like a condition for search pages that includes empty-result ones should be popped in above this line.

    I get the same Warning on my Search Results page.

    Notice: Undefined variable: below_excerpt in
    /var/lib/openshift/5580f1314382ecbe2d000009/app-root/runtime/repo/wp-
    content/plugins/addthis/addthis_social_widget.php on line 1301
    Plugin Contributor Julka Grodel

    (@jgrodel)

    We released 5.2.0 earlier today, and these notices should no longer appear in it.

    Please feel free to reach out to us here or at help@addthis.com if you still see this happening after upgrading to 5.2.0.

    Thanks,
    Julka

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP Notice: addthis_social_widget.php:1301 Undefined variable: below_excerpt fix’ is closed to new replies.