The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Adding Additional Open Graph Tags in FoxyShop

brucepbrucep Member
in Help edited August 2013
Does anyone know if there is a custom hook for foxyshop to add additional open graph meta tags to product pages? It appears to currently generate og:type, og:title, og:url, og:site-name, and og:image. I'm getting ready to implement rich pins and would like to pull product info for the og:description (using the product:short description), og:price:amount (sale-price) and og:price:currency (not sure where this would pull from).
Comments
  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    @brucep, Currently there isn't a hook for this, but I'd be happy to add one. In helperfunctions.php change the 'foxyshop_social_media_header_meta' function to read like this:
    //Set Social Media Meta Tags In Header (Facebook, Google+)
    //Google+ suggests you to put this in your <html> tag on the product pages: <html itemscope itemtype="http://schema.org/Product">;
    function foxyshop_social_media_header_meta() {
    	global $product;
    	$product = foxyshop_setup_product();
    	echo '<meta property="og:title" content="' . esc_attr($product['name']) . '" />'."\n";
    	echo '<meta property="og:type" content="product" />'."\n";
    	echo '<meta property="og:url" content="' . esc_attr($product['url']) . '" />'."\n";
    	echo '<meta property="og:site_name" content="' . esc_attr(get_bloginfo('name')) , '" />'."\n";
    	if (foxyshop_get_main_image()) {
    		echo '<meta property="og:image" content="' . esc_attr(foxyshop_get_main_image()) . '" />'."\n";
    		echo '<link rel="image_src" href="' . esc_attr(foxyshop_get_main_image()) . '" />'."\n";
    		echo '<meta itemprop="image" content="' . esc_attr(foxyshop_get_main_image()) . '" />'."\n";
    	}
    	echo '<meta itemprop="name" content="' . esc_attr($product['name']) . '" />'."\n";
    	if ($product['short_description']) echo '<meta itemprop="description" content="' . esc_attr($product['short_description']) . '" />'."\n";
    
    	//Add Filter
    	echo apply_filters('foxyshop_spcial_media_header', "");
    }
    

    And I will make sure this code gets included in the next version of FoxyShop.
  • Thank you. I don't mind mods on the helper function file as I track that file and mods in when upgrading.
Sign In or Register to comment.