Skip to content

Instantly share code, notes, and snippets.

@tiberiur
tiberiur / head.phtml
Last active May 6, 2016 13:38
[Magento] Facebook Open Graph Snippets
<?php /* Open Graph Protocol for Facebook and SEO START */ ?>
<?php if(Mage::registry('current_product')): ?>
<?php $product = Mage::registry('current_product'); ?>
<meta property="og:title" content="<?php echo ($product->getName()); ?>" />
<meta property="og:type" content="product" />
<meta property="og:image" content="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(200,200);?>" />
<meta property="og:url" content="<?php echo Mage::registry('product')->getProductUrl(); ?>" />
<meta property="og:description" content="<?php echo strip_tags(($product->getShortDescription())); ?>" />
<meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName(); ?>" />
<?php elseif(Mage::registry('current_category')): ?>
@wpscholar
wpscholar / array-insert-after.php
Created November 7, 2015 13:04
Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended to the end of the array.
<?php
/**
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended
* to the end of the array.
*
* @param array $array
* @param string $key
* @param array $new
*