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 | |
#Change your db username, password & database name | |
if [ -f ~/Desktop/db_schema.html ]; then | |
rm ~/Desktop/db_schema.html | |
fi | |
for i in `mysql -B -N -uroot -proot dbname -e 'show tables;'`; do | |
echo "<a href='#$i'>$i</a><br />" >> /tmp/$$.nav.html |
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
/** | |
* Function to remove wpautop filter for specific post IDs | |
*/ | |
add_action( 'init', 'do_ma_thang' ); | |
function do_ma_thang() { | |
global $wp_query; | |
$exclusion = array( 1, 5, 7 ); // add post IDs 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
<pre><?php | |
require 'wp-load.php'; | |
$postmeta_field_name = 'video_url'; // fill it | |
echo $query = "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = '$postmeta_field_name';"; | |
$data = $wpdb->get_results( $query ); |
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
# Count no of files in repo | |
svn info -R --xml file:///path/to/rep | grep kind=\"file\"|wc -l | |
# SVN command to give commit authors list and save it in author-transform.txt | |
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt | |
OlderNewer