This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( array_key_exists('freeshipping', $_shippingRateGroups )) { | |
$_shippingRateGroups = array('freeshipping' => $_shippingRateGroups['freeshipping']); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# $1 -> command to execute | |
WPPATH=$(pwd) | |
sudo -u www-data -i -- wp $@ --path=$WPPATH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scrollToAnchor(aid){ | |
var aTag = $("a[name='"+ aid +"']"); | |
$('html,body').animate({scrollTop: aTag.offset().top},'slow'); | |
} | |
scrollToAnchor('id3'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Instrument Hooks for WordPress | |
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook. | |
Version: 0.1 | |
Author: Mike Schinkel | |
Author URI: http://mikeschinkel.com | |
*/ | |
if ($_GET['instrument']=='hooks') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('registered_post_type', 'custom_registered_post_type_handler', 10, 2); | |
function custom_registered_post_type_handler($post_type, $args) { | |
do_action("custom_registered_{$post_type}_post_type", $post_type, $args); | |
} | |
add_action('custom_registered_foo_post_type', 'custom_registered_foo_post_type_handler', 10, 2); | |
function custom_registered_foo_post_type_handler($post_type, $args) { | |
remove_action(current_filter(), __FUNCTION__, 10, 2); // only run once | |
// change your args here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_col(array $a, $x) | |
{ | |
return array_map(function($a) use ($x) { return $a[$x]; }, $a); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_col(array $a, $x) | |
{ | |
return array_map(function($a) use ($x) { return $a[$x]; }, $a); | |
} | |
$max = max(array_col($menu_items, 'colonna')); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try{ | |
$category = Mage::getModel('catalog/category'); | |
$category->setName('check'); | |
$category->setUrlKey('new-category'); | |
$category->setIsActive(1); | |
$category->setDisplayMode('PRODUCTS'); | |
$category->setIsAnchor(1); //for active achor | |
$category->setStoreId(Mage::app()->getStore()->getId()); | |
$parentCategory = Mage::getModel('catalog/category')->load($parentId); |