Skip to content

Instantly share code, notes, and snippets.

View kepek's full-sized avatar
💭
I may be slow to respond.

Michal Kechner kepek

💭
I may be slow to respond.
View GitHub Profile
@kepek
kepek / head.phtml
Created July 27, 2011 13:04
Quick Social Media for Magento
<!-- SOCIAL NETWORK CODE -->
<script type="text/javascript" src="http://connect.facebook.net/<?php echo Mage::app()->getLocale()->getLocaleCode() ?>/all.js#xfbml=1"></script>
<script type="text/javascript" src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"></script>
<?php $_product = Mage::registry('current_product'); if($_product): ?>
<?php $_header = new Mage_Page_Block_Html_Header(); ?>
<meta property="og:title" content="<?php echo $this->stripTags($_product->getName(), null, true) ?>"/>
<meta property="og:url" content="<?php echo $this->helper('core/url')->getCurrentUrl();?>"/>
<meta property="og:type" content="product"/>
<meta property="og:image" content="<?php echo $this->helper('catalog/image')->init($_product, 'image') ;?>"/>
<meta property="og:site_name" content="<?php echo $_header->getLogoAlt() ?>" />
@kepek
kepek / gist:1307371
Created October 23, 2011 13:42
IE6 CSS
<!--[if lte IE 6]>
<link rel="stylesheet" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" media="screen, projection" />
<![endif]-->
function aboriginal_theme_option($atts) {
// EXAMPLE USAGE:
// [theme_option show="company_address"]
$options = aboriginal_get_theme_options();
extract(shortcode_atts(array(
'show' => ''
), $atts));
return $options[$show] ? $options[$show] : false;
}
add_shortcode('theme_option', 'aboriginal_theme_option');
@kepek
kepek / gist:1398017
Created November 27, 2011 19:22
Custom Author Permalink for Wordpress
<?php
function kepek_author_rewrite() {
global $wp_rewrite;
$wp_rewrite->author_base = 'autor';
$wp_rewrite->flush_rules();
}
add_action('init', 'kepek_author_rewrite');
@kepek
kepek / gist:1404560
Created November 29, 2011 11:56
Magento Multilanguage Category Description (Fast Workaround)
<?php
/* Vritual Helper Function */
public function translate($text = false, $lang = false) {
$lang = $lang ? $lang : Mage::app()->getLocale()->getLocaleCode();
if($text) {
preg_match('#\[translate lang="'.$lang.'"\](.*?)\[/translate\]#si', $text, $match);
if($match) {
$output = trim($match[1]);
@kepek
kepek / gist:1431650
Created December 4, 2011 23:31
Mac OS X Lion 10.7.2 Font Smoothing fix for Terminal/Textmate apps.
// Run this command in Terminal.app:
defaults -currentHost write -globalDomain AppleFontSmoothing -int 2
@kepek
kepek / gist:1433722
Created December 5, 2011 14:21
noConflict jQuery
!function($) {
$(document).ready(function() {
/* jestem wesoly romek */
});
}(window.jQuery || window.ender);
<?php
function kepek_excerpt_paragraph_class($excerpt) {
$excerpt = str_replace('<p', '<p class="excerpt"', $excerpt);
return $excerpt;
}
add_filter('the_excerpt', 'kepek_excerpt_paragraph_class');
@kepek
kepek / Navigation.php
Created January 24, 2012 11:10
/app/code/local/Mage/Catalog/Block/
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
/* Smaller than standard 960 (devices and browsers) */
@media only screen and (max-width: 959px) {
}
/* Tablet Portrait size to standard 960 (devices and browsers) */
@media only screen and (min-width: 768px) and (max-width: 959px) {
}