2016-06-07 261 views
-1

希望大家都清楚,我需要你的幫助,我在我的wordpress網站面臨的一個問題,當我發表我的Facebook頁面上我的網站的網址顯示它的隨機圖像,其我不想please check this screenshot面臨當我在Facebook上發佈我的網站鏈接的問題

在此圖像中,你很容易理解我說的這些問題,我想網站的標識代替空間圖像顯示出來,請人helpme出來吧,謝謝你在前進

+0

確實[這](http://stackoverflow.com/questions/19632323/default-website-image-for-social-sharing)幫助?你應該可以在標題中使用''標記來設置它(我假設你知道如何編輯你的主題)。請注意,Facebook需要一定的尺寸和高寬比(圖像不能很薄或很寬);不記得,雖然 – Hobo

回答

0

你需要把開放圖形標籤在你header.php。我通常使用這樣的組合:

<?php 
    $theme = wp_get_theme(); 
    $screenshot_url = esc_url($theme->get_screenshot()); 
if (is_home()): ?> 

<meta property="og:url"   content="<?php echo get_home_url(''); ?>" /> 
<meta property="og:type"   content="website" /> 
<meta property="og:title"   content="<?php echo get_bloginfo('name'); ?>" /> 
<meta property="og:description" content="<?php echo get_bloginfo('description'); ?>" /> 
<meta property="og:image"   content="<?php echo $screenshot_url; ?>" /> 

<?php elseif(is_category()): 
    $cat_id = get_query_var('cat'); 
    $cat_name = get_cat_name($cat_id); 
    $cat_desc = (category_description($cat_id) != '') ? category_description($cat_id) : get_bloginfo('description');  
?> 

<meta property="og:url"   content="<?php echo get_category_link($cat_id); ?>" /> 
<meta property="og:type"   content="website" /> 
<meta property="og:title"   content="<?php echo $cat_name; ?>" /> 
<meta property="og:description" content="<?php echo $cat_desc; ?>" /> 
<meta property="og:image"   content="<?php echo $screenshot_url; ?>" /> 

<?php else: ?> 

<meta property="og:url"   content="<?php the_permalink(); ?>" /> 
<meta property="og:type"   content="website" /> 
<meta property="og:title"   content="<?php echo get_the_title(); ?>" /> 
<meta property="og:description" content="<?php echo get_the_excerpt(); ?>" /> 
<?php if(has_post_thumbnail()): 
    $url = wp_get_attachment_url(get_post_thumbnail_id()); 
?> 
<meta property="og:image"   content="<?php echo $url; ?>" /> 
<?php else: ?> 
<meta property="og:image"   content="<?php echo $screenshot_url; ?>" /> 

<?php endif; ?> 

<?php endif; ?> 

我放回家,類別和其他頁面單獨OG標籤,也可能降低爲主題形象(這可防止隨機圖像被選中)。

希望這會有所幫助。

+0

嘗試過,但沒有成功,實際上這表明對限制作爲縮略圖圖像http://imgur.com/4x1eaZi –

+0

然後,你必須在你的頁面上有一些插件來彌補一些東西。你可以編輯你的帖子,並顯示你在你的標籤放置這些代碼時有什麼? –

+0

我沒有爲同任何特定的職位,而且我沒有使用社交鏈接 –

0

嘗試把OpenGraph圖像標籤,像這樣

<meta property="og:image" content="link to your logo" /> 
0

試試這個:

<meta property="og:image" content="<?php the_post_thumbnail(); ?>" /> 
<meta property="og:title" content="<?php the_title(); ?>" /> 
<meta property="og:description" content="<?php the_content(); ?>" /> 
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" /> 
<meta property="og:type" content="article" /> 
<meta property="og:locale" content="en_US" /> 
<meta property="og:url" content="<?php the_permalink(); ?>" /> 
<meta property="og:title" content="<?php the_title(); ?>" /> 
<meta property="article:published_time" content="<?php echo get_the_time(); ?>" /> 
<meta property="article:modified_time" content="<?php the_modified_date(); ?>" /> 
<meta property="article:author" content="<?php the_author(); ?>" /> 
<meta property="article:section" content="Featured" /> 
<meta property="article:tag" content="<?php the_tags(); ?>" /> 

http://happybloggerplaza.com/how-to-fix-thumbnail-image-facebook/ https://wordpress.org/plugins/facebook-thumb-fixer/other_notes/

相關問題