Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

I need some serious help... WordPress

  • SOLVED

I've been struggling with a situation on my Woocommerce site with the ogg info being sent.

I just went back through things and activated Yoast's social settings unfortunately it's throwing a 404 error when trying to connect to Facebook.

The problem I'm having if I'm not using Yoast's social features is that it will pull the correct text from the page that is being shared but it's always sending my background image instead of the page/post/product's featured image.

I really don't have time to try to figure this out on my own as it's 'above my payscale'. I haven't a clue where to even begin to try and fix this.

Someone told me that my themes pulling the header information twice and getting caught in a loop. Whatever that means.

I'm so frustrated with this I'd like to just give this $10 for someone to jump in and fix this issue. Anyone care to dive in?

http://unglove.me

Answers (1)

2014-02-02

Navjot Singh answers:

Check your theme's header.php for this code

<?php wp_head(); ?>

Check if it appears twice. If it does, remove one.


Doug Montgomery comments:

It doesn't... Here's my header.php...

<head>

<!-- Basic Page Needs
================================================== -->
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>

<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!-- CSS
================================================== -->
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />

<?php global $gdl_is_responsive ?>
<?php if( $gdl_is_responsive ){ ?>
<meta name="viewport" content="width=device-width, user-scalable=no">
<link rel="stylesheet" href="<?php echo GOODLAYERS_PATH; ?>/stylesheet/foundation-responsive.css">
<?php }else{ ?>
<link rel="stylesheet" href="<?php echo GOODLAYERS_PATH; ?>/stylesheet/foundation.css">
<?php } ?>

<!--[if IE 7]>
<link rel="stylesheet" href="<?php echo GOODLAYERS_PATH; ?>/stylesheet/ie7-style.css" />
<link rel="stylesheet" href="<?php echo GOODLAYERS_PATH; ?>/stylesheet/font-awesome/font-awesome-ie7.min.css" />
<![endif]-->

<?php

// include favicon in the header
if(get_option( THEME_SHORT_NAME.'_enable_favicon','disable') == "enable"){
$gdl_favicon = get_option(THEME_SHORT_NAME.'_favicon_image');
if( $gdl_favicon ){
$gdl_favicon = wp_get_attachment_image_src($gdl_favicon, 'full');
echo '<link rel="shortcut icon" href="' . $gdl_favicon[0] . '" type="image/x-icon" />';
}
}

// add facebook thumbnail to this page
$thumbnail_id = get_post_thumbnail_id();
if( !empty($thumbnail_id) ){
$thumbnail = wp_get_attachment_image_src( $thumbnail_id , '150x150' );
echo '<meta property="og:image" content="' . $thumbnail[0] . '"/>';
}

// start calling header script
wp_head();

?> <?php wp_head(); ?>
</head>
<body


Doug Montgomery comments:

It does...I see it...Trying the fix now.


Navjot Singh comments:

It does actually. The last few lines are


// start calling header script

wp_head();

?> <?php wp_head(); ?>
</head>
<body


wp_head(); function is reponsble and occurs twice.

Delete this line

<?php wp_head(); ?>

That should sort the duplicacy in the header.


Navjot Singh comments:

Also remove this code

// add facebook thumbnail to this page

$thumbnail_id = get_post_thumbnail_id();

if( !empty($thumbnail_id) ){

$thumbnail = wp_get_attachment_image_src( $thumbnail_id , '150x150' );

echo '<meta property="og:image" content="' . $thumbnail[0] . '"/>';

}


The Yoast plugin is already picking up the product images from what I see. With this code, there are multiple images that get included.


Doug Montgomery comments:

Ya, I caught that...but it didn't help.

I actually deleted "wp_head();?>" first and that threw a parse error then went back and deleted the other. The page loads but it doesn't solve my ogg problem.


Navjot Singh comments:

Problem seems to be fixed now.


Doug Montgomery comments:

Ok...kicked that code too but didn't solve the problem.

Something I just realized...it's product specific...For example:

These work....
http://unglove.me/shop/pocket-chalker-pool-cue-chalk-wrap/
http://unglove.me/shop/pool-chalk-holder-finger-loop/

The others don't
http://unglove.me/shop/case-clip-pool-cue-chalk-holder/
http://unglove.me/shop/pocketchalker-pool-cue-chalk-holder/
http://unglove.me/shop/fingerwraps-pool-glove/

Yoast also throws a 404 when trying to connect to the Facebook dashboard in the settings. Not sure if that has anything to do with it.


Navjot Singh comments:

Its sending background images where? I just tried to share the url which you said is not working on both here - https://developers.facebook.com/tools/debug/ and tried sharing on my facebook timeline. At both the places, the correct product image was shared.


Doug Montgomery comments:

Ok...All but one seems to be working now...

This one isn't working...
http://unglove.me/shop/pocketchalker-pool-cue-chalk-holder/


Doug Montgomery comments:

It's taking the opaque background of billiard balls and using it as the image... Looking at some other things also...


Navjot Singh comments:

Ok I see it.


Navjot Singh comments:

That url is working at my side for now. Facebook might have cached the urls for some time. Now seems to be working. Check again.


Doug Montgomery comments:

This is weird. I thought maybe I had a custom field maybe with an image in it's place but no.

Now I'm a bit confused..


Doug Montgomery comments:

Great I see that now also....

Now here's a trick question... How can I force the correct image size so they aren't blown up out of the water?


Navjot Singh comments:

You will need to add a new image size, regenerate all thumbnails and then tell Yoast to use that new size to show in opengraph meta tags. Procedure is mentioned in [[LINK href="http://webgilde.com/en/wordpress-seo-facebook-image-open-graph/"]]this article[[/LINK]].


Doug Montgomery comments:

Thanks...I went through that information and put in the suggested snippets of code...When I did the thumb regen it didn't pick up the new image size.

This is just a 'chunk of' the last part of my funtions.php code. You can see at the bottom where I added the extra snippets from the article you referenced.

// exterior plugins
if(!class_exists('ReallySimpleCaptcha') && (get_option(THEME_SHORT_NAME.'_enable_comment_captcha', 'enable') == 'enable')){
$temp_root = get_root_directory('include/plugin/really-simple-captcha/really-simple-captcha.php');
include_once($temp_root . 'include/plugin/really-simple-captcha/really-simple-captcha.php'); // capcha comment plugin class
$temp_root = get_root_directory('include/plugin/really-simple-captcha/cbnet-really-simple-captcha-comments.php');
include_once($temp_root . 'include/plugin/really-simple-captcha/cbnet-really-simple-captcha-comments.php'); // capcha comment plugin
}

if(!class_exists('Filosofo_Custom_Image_Sizes')){
$temp_root = get_root_directory('include/plugin/filosofo-image/filosofo-custom-image-sizes.php');
include_once($temp_root . 'include/plugin/filosofo-image/filosofo-custom-image-sizes.php'); // Custom image size plugin

}

$temp_root = get_root_directory('include/plugin/dropdown-menus.php');
include_once($temp_root . 'include/plugin/dropdown-menus.php'); // Custom dropdown menu
$temp_root = get_root_directory('include/plugin/description-menu.php');
include_once($temp_root . 'include/plugin/description-menu.php'); // Description menu

// unregister all widgets
function unregister_default_widgets() {
unregister_widget('WP_Widget_Pages');
unregister_widget('WP_Widget_Calendar');
unregister_widget('WP_Widget_Archives');
unregister_widget('WP_Widget_Links');
unregister_widget('WP_Widget_Meta');
unregister_widget('WP_Widget_Search');
unregister_widget('WP_Widget_Text');
unregister_widget('WP_Widget_Categories');
unregister_widget('WP_Widget_Recent_Posts');
unregister_widget('WP_Widget_Recent_Comments');
unregister_widget('WP_Widget_RSS');
unregister_widget('WP_Widget_Tag_Cloud');
unregister_widget('Twenty_Eleven_Ephemera_Widget');
}
add_action('widgets_init', 'unregister_default_widgets', 11);

add_filter('the_content', 'my_addlightboxrel');
function my_addlightboxrel($content) {
global $post;
$pattern ="/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";
$replacement = '<a$1href=$2$3.$4$5 rel="lightbox" title="'.$post->post_title.'"$6>';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}

if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'facebook', 600, 315 );
}

add_filter('wpseo_opengraph_image_size', 'mysite_opengraph_image_size');
function mysite_opengraph_image_size($val) {
return 'facebook';
}
?>



I also notice this code which I'm not too sure about...maybe it's doing something...

if(!class_exists('Filosofo_Custom_Image_Sizes')){
$temp_root = get_root_directory('include/plugin/filosofo-image/filosofo-custom-image-sizes.php');
include_once($temp_root . 'include/plugin/filosofo-image/filosofo-custom-image-sizes.php'); // Custom image size plugin

}


Doug Montgomery comments:

You'll notice that I've added other changes to this file but I have to be honest, I'm not sure if I've done it correctly. If I understand right I should just be able to continue to add 'if' statements and 'funtions' to the end of the file as long as they are complete and correctly written. Is this right?

I really appreciate your help. I've been trying for WEEKS to get this done. I just hope you can stick around till I get this worked out tonight.