Fix Facebook Like
Important piece of logic missing causes fatal error (1 post)

  1. Jeff Farthing
    Posted 4 years ago #

    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.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Fix Facebook Like
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by Jeff Farthing
  • This topic is not a support question
  • WordPress version: 3.2.1


No tags yet.