Support » Fixing WordPress » Adding 'add theme support' to functions.php

  • Hi All.

    My current functions.php file (for my own theme) looks like this:

    <?php //Adding the Open Graph in the Language Attributes
    function add_opengraph_doctype( $output ) {
    		return $output . ' xmlns:og="" xmlns:fb=""';
    add_filter('language_attributes', 'add_opengraph_doctype');
    //Lets add Open Graph Meta Info
    function insert_fb_in_head() {
    	global $post;
    	if ( !is_single()) //if it is not a post or a page
            echo '<meta property="fb:admins" content="14412758189"/>';
            echo '<meta property="og:title" content="' . get_the_title() . '"/>';
            echo '<meta property="og:type" content="article"/>';
            echo '<meta property="og:url" content="' . get_permalink() . '"/>';
            echo '<meta property="og:description" content="' . strip_tags(get_the_excerpt()) . '"/>';
            echo '<meta property="og:site_name" content="' .  get_bloginfo('name') . '"/>';
    	if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
    		echo '<meta property="og:image" content="' . $default_image . '"/>';
    		$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
    		echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';
    	echo "";
    add_action( 'wp_head', 'insert_fb_in_head', 5 ); ?>

    This is simply to get Facebook OG information.

    I tried to add:

    <?php add_theme_support( 'post-thumbnails' ); ?>

    Underneath this to enable me to assign a default image when posting, which will put the image in the fb:image for the post.

    However, this seems to break the site – when I click on the ‘like’ button, the page is blank.

    Could anyone please help? Thanks…

  • The topic ‘Adding 'add theme support' to functions.php’ is closed to new replies.