WordPress.org

Support

Support » Plugins and Hacks » Fix Facebook Like » [Plugin: Fix Facebook Like] Important piece of logic missing causes fatal error

[Plugin: Fix Facebook Like] Important piece of logic missing causes fatal error

  • There is a problem that will cause a fatal error for any theme that is not using post thumbnails.

    At line 205 of your code, you attempt to get the post thumbnail. However, WordPress does not include /wp-incldes/post-thumbnail-template.php unless the theme is using post thumbnails, thus creating a fatal function not defined error. You need to first determine if the theme supports post thumbnails:

    <?php if ( is_home() || is_front_page() ) { ?>
    <meta property="og:image" content="<?php echo $logo ?>"/>
    <?php } elseif ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) ) { ?>
    <meta property="og:image" content="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>"/>
    <?php } ?>

    Also, you’re not even defining $post as global within the function, so $post is empty.

    http://wordpress.org/extend/plugins/fix-facebook-like/

  • The topic ‘[Plugin: Fix Facebook Like] Important piece of logic missing causes fatal error’ is closed to new replies.
Skip to toolbar