• 13-03-2017, 23:04:53
    #1
    Arkadaşlar Merhaba,

    Tema da aşağıdaki gibi facebook paylaş butonu var. Paylaş dediğinde pencere açıp ilgili konu ve başlığı geliyor, fakat resim bir türlü çıkmıyor. Sorun aşağıdaki koddan mı yoksa tema içinde mi bir ayar yapılacak bilemedim. Hemen hemen bulduğum tüm kodlarda aşağıdaki gibi. Sanırım wordpress içerisinde bi ayar gerekiyor fakat bulamadım.

    <a class="facepaylas" href="" onclick="window.open('https://www.facebook.com/sharer.php?u=<?php the_permalink('');?>', '_blank', 'toolbar=no, scrollbars=no, resizable=no, top=500, left=500, width=600, height=400');return false;">Facebook'ta Paylaş</a>
  • 14-03-2017, 01:40:55
    #2
    Opengraph hatasından kaynaklanıyor. Aşağıdaki kodu functions.php ye ekleyin.

    //Adding the Open Graph in the Language Attributes
    function add_opengraph_doctype( $output ) {
    		return $output . ' xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"';
    	}
    add_filter('language_attributes', 'add_opengraph_doctype');
    
    //Lets add Open Graph Meta Info
    
    function insert_fb_in_head() {
    	global $post;
    	if ( !is_singular()) //if it is not a post or a page
    		return;
            echo '<meta property="fb:admins" content="YOUR USER ID"/>';
            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:site_name" content="Your Site NAME Goes HERE"/>';
    	if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
    		$default_image="http://example.com/image.jpg"; //replace this with a default image on your server or an image in your media library
    		echo '<meta property="og:image" content="' . $default_image . '"/>';
    	}
    	else{
    		$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 );
  • 14-03-2017, 10:00:19
    #3
    bilimokur adlı üyeden alıntı: mesajı görüntüle
    Opengraph hatasından kaynaklanıyor. Aşağıdaki kodu functions.php ye ekleyin.

    //Adding the Open Graph in the Language Attributes
    function add_opengraph_doctype( $output ) {
    		return $output . ' xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"';
    	}
    add_filter('language_attributes', 'add_opengraph_doctype');
    
    //Lets add Open Graph Meta Info
    
    function insert_fb_in_head() {
    	global $post;
    	if ( !is_singular()) //if it is not a post or a page
    		return;
            echo '<meta property="fb:admins" content="YOUR USER ID"/>';
            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:site_name" content="Your Site NAME Goes HERE"/>';
    	if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
    		$default_image="http://example.com/image.jpg"; //replace this with a default image on your server or an image in your media library
    		echo '<meta property="og:image" content="' . $default_image . '"/>';
    	}
    	else{
    		$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 );
    Hocam vcevap için teşekkürler, fakat function dosyam ioncube ile şifrelenmiş. Başka bir yöntemi var mı acaba.
  • 14-03-2017, 16:23:18
    #4
    içerisine php tagıyla eklersen çalışabilir. tam emin değilim ama. yedek alarak deneyin mutlaka. Bunun için eklentiler mevcut ayrıca.