Skip to content

Instantly share code, notes, and snippets.

Ashish Kumar ashfame

Block or report user

Report or block ashfame

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ashfame
ashfame / synthesis.php
Created Sep 3, 2014
WP CLI commands available on web-synthesis servers
View synthesis.php
<?php
function synth_clear_mem_check () {
delete_transient( 'synthesis_memory_check' );
}
add_action('update_option_active_plugins', 'synth_clear_mem_check');
// If we're running from WP CLI, add our CLI commands.
if ( defined( 'WP_CLI' ) && WP_CLI ) {
class Synthesis_Ops_Commands extends WP_CLI_Command {
/**
@ashfame
ashfame / facebook-like-thumbnail-force-default-image-everywhere.php
Last active Aug 29, 2015
Forcing single thumbnail to be used on Facebook with "Facebook Like Thumbnail" plugin
View facebook-like-thumbnail-force-default-image-everywhere.php
<?php
/**
* Plugin Name: Facebook Like Thumbnail - Force Default Image everywhere
* Plugin URI: https://gist.github.com/ashfame/62f59587aaa5c8ecb1ce
* Description: Forces the default image to be used as FB Thumbnail for every page
* Author: Ashfame
* Author URI: http://ashfame.com/
*/
@ashfame
ashfame / snippet.php
Created Mar 19, 2014
Querying post relationships in reverse direction when using Advanced Custom Fields plugin on WordPress
View snippet.php
<?php
$tour_pages = get_posts(
array(
'post_type' => 'tour',
'meta_query' => array(
array(
'key' => 'tour_author_relationship', // name of custom field
'value' => '"' . get_the_ID() . '"',
'compare' => 'LIKE'
)
@ashfame
ashfame / woocommerce-category-images-from-product.php
Last active Jun 25, 2019
Use WooCommerce product image as its category image, if category image is missing
View woocommerce-category-images-from-product.php
<?php
/**
* Plugin Name: WooCommerce Category Images Modification
* Plugin URI: http://blog.ashfame.com/?p=1117
* Description: Use product image as its category image on category archive pages (To override image for product category, upload one for that category and it will override)
* Author: Ashfame
* Version: 0.1.2
* Author URI: http://ashfame.com/
*/
@ashfame
ashfame / after.php
Created Mar 17, 2014
Using WooCommerce email design in custom emails
View after.php
$email = 'ashfame@example.com';
$subject = 'Custom stuff email';
$email_heading = 'Custom Heading';
$email_content = ''; // whatever it is
ob_start();
do_action( 'woocommerce_email_header', $email_heading );
echo $email_content; // or simply have HTML markup outside PHP tags here
@ashfame
ashfame / magento-set-defaults-address.php
Created Jun 13, 2013
Programmatically set default billing/shipping address of customers if they are not set in magento
View magento-set-defaults-address.php
<?php
require_once ("app/Mage.php");
umask(0);
Mage::app("default");
$collection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('*');
foreach ($collection as $customer) {
@ashfame
ashfame / ios-test.css
Created Dec 9, 2012 — forked from tonywok/ios-test.css
iOS Media Queries
View ios-test.css
// iOS Media Queries
// Goal: capture styles for iPhone, iPhone 3G, iPhone 3GS, iPhone 4, iPhone 4S, iPad, and iPad 2
//
// Author: Tony Schneider (@tonywok)
// Please tell me where I fail. :)
// iPhone v(4,4S) portrait
// test: black text (overwritten by v* portrait) with blue background
@media all and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {
a {
@ashfame
ashfame / .gitignore
Created Dec 5, 2012
Magento repo sample .gitignore
View .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@ashfame
ashfame / driver.js
Created Aug 7, 2012
kissmetrics-property-device
View driver.js
(function(){
var isFirstVisit = false;
if ( document.referrer == '' ) {
isFirstVisit = true;
} else {
// If referrer is not the site itself
if ( ! ( document.referrer.match( window.location.host ) ) )
isFirstVisit = true;
}
if ( isFirstVisit ) {
@ashfame
ashfame / generate-thumbnails.php
Created Aug 5, 2012 — forked from Viper007Bond/generate-thumbnails.php
WordPress: When a thumbnail image is requested of a specific width/height (rather than by name), generate it if it doesn't exist.
View generate-thumbnails.php
<?php /*
**************************************************************************
Plugin Name: Generate Thumbnails On The Fly
Description: When a thumbnail image is requested of a specific width/height (rather than by name), generate it if it doesn't exist.
Version: 1.0.0
Author: Alex Mills (Viper007Bond)
Author URI: http://www.viper007bond.com/
You can’t perform that action at this time.