This file contains 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
$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 |
This file contains 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: 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/ | |
*/ |
This file contains 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 | |
$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' | |
) |
This file contains 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: 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/ | |
*/ |
This file contains 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 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 { | |
/** |
This file contains 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( 'set_transient_my_transient', function( $value, $expiration ) { | |
$desired_expiration = 600; | |
if ( $expiration != $desired_expiration ) { | |
set_transient( 'my_transient', $value, $desired_expiration ); | |
} | |
}); |
This file contains 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: AnattaDesign Site Optimizer | |
* Plugin URI: http://anattadesign.com/ | |
* Description: This plugin optimizes the site by reducing the extra number of queries triggered by plugins to look for non-existent options in options table | |
* Version: 0.1 | |
* Author: Anatta Design | |
* Author URI: http://anattadesign.com/ | |
*/ |
This file contains 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 ( defined('WP_CLI') && WP_CLI ) { | |
class Transient_Mod_Command extends Transient_Command { | |
public function delete_all() { | |
// new definition of delete-all subcommand | |
} | |
} | |
This file contains 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
$nodes = array(); | |
for ( $i = 1; $i <= 100; $i++ ) { | |
$nodes[ $i ] = ''; | |
} | |
print_r( $nodes ); | |
foreach ( $nodes as $key => &$node ) { | |
$random_keys_selection = array_rand( $nodes, mt_rand( 3, 7 ) ); | |
var_dump( $random_keys_selection ); |
This file contains 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 | |
# | |
# This script configures WordPress file permissions based on recommendations | |
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
# | |
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org> | |
# | |
WP_OWNER=www-data # <-- wordpress owner | |
WP_GROUP=www-data # <-- wordpress group | |
WP_ROOT=$1 # <-- wordpress root directory |