problems with displaying images when publishing facebook
https://www.evernote.com/shard/s163/sh/96370e95-7232-4580-ab3d-02f3ed6114dd/e28c71e5d83aa6501b2b2cb8d869ade8
Hello Taras ! The following instruction will help you address the issue you are facing, let’s take a look at:
1. Open functions.php file in /wp-content/themes/dw-focus/functions.php
2. Replace the following code – form line 474 to line 496
if( ! function_exists('dw_focus_post_views') ) {
/**
* Views count for a single post
*/
function dw_focus_post_views() {
if( is_single() ){
global $post;
$view = get_post_meta($post->ID, '_views', true);
$view = $view ? $view+1 : 1;
update_post_meta($post->ID, '_views', $view);
echo '<meta property="og:title" content="'.get_the_title().'" />';
echo '<meta property="og:url" content="'.get_permalink().'" />';
if( has_post_thumbnail() ) {
$thumb_id = get_post_thumbnail_id();
$thumb = wp_get_attachment_thumb_url( $thumb_id );
echo '<meta property="og:image" content="'.$thumb.'" />';
}
echo '<meta property="og:description" content="'. esc_html( get_the_excerpt() ) .'"/>';
}
}
add_action('wp_head', 'dw_focus_post_views');
}
with the code below:
// if( ! function_exists('dw_focus_post_views') ) {
// /**
// * Views count for a single post
// */
// function dw_focus_post_views() {
// if( is_single() ){
// global $post;
// $view = get_post_meta($post->ID, '_views', true);
// $view = $view ? $view+1 : 1;
// update_post_meta($post->ID, '_views', $view);
// echo '<meta property="og:title" content="'.get_the_title().'" />';
// echo '<meta property="og:url" content="'.get_permalink().'" />';
// if( has_post_thumbnail() ) {
// $thumb_id = get_post_thumbnail_id();
// $thumb = wp_get_attachment_thumb_url( $thumb_id );
// echo '<meta property="og:image" content="'.$thumb.'" />';
// }
// echo '<meta property="og:description" content="'. esc_html( get_the_excerpt() ) .'"/>';
// }
// }
// add_action('wp_head', 'dw_focus_post_views');
// }
Save it and see how that goes. Hope this helps !
I did as you said
but loads facebook photo size 110 x 110
https://www.evernote.com/shard/s163/sh/1dcab957-ccc5-4bb9-bc92-faec1dae4114/133ebb85b8321044abe68dd74b91ddd9
but this is not enough to display large pictures in Facebook
and I need that would like this shows:
https://www.evernote.com/shard/s163/sh/e1f62b8d-35bb-4836-941d-e4893bc2024c/8684a2d8abfea14e9e21e998c5c7870b
Hi Taras,
To resolve this issue, please follow my instruction here:
1. Open functions.php file in /wp-content/themes/dw-focus/functions.php
2. Replace following code – line 489
$thumb = wp_get_attachment_thumb_url( $thumb_id );
with the code below:
$thumb = wp_get_attachment_url( $thumb_id );
Note: If your problem persists, could you kindly grant me access to your back-end for further checking? To do so, please provide me your site URL and admin account (via private answer).
Hope this helps !
Hi,
I have the same problem.
I have try the above solutions but i getting the same – photo 110
Any ideas?
Please login or Register to submit your answer