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 | |
// This will be accessible at /feed/zones-json/ | |
add_feed( 'zones-json', 'x_render_zones_json_feed' ); | |
function x_render_zones_json_feed() { | |
if ( function_exists( 'z_get_zone_query' ) ) { | |
$query = z_get_zone_query( 'zone-name' ); | |
header('Content-type: application/json'); |
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 | |
$testimonial = false; | |
$testimonials_query = new WP_Query( array( 'fields' => 'ids', 'posts_per_page' => 20 ) ); | |
if ( ! empty ( $testimonials_query->posts ) ) { | |
$testimonials = $testimonials_query->posts; | |
shuffle( $testimonials ); | |
$testimonial_id = array_shift( $testimonials ); | |
$testimonial = get_post( $testimonial_id ); |
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
rsync -rv --delete --exclude='.svn' /from /to | |
cd /to | |
svn status | grep '^!' | awk '{print $2}' | xargs svn rm | |
svn status | grep '^?' | awk '{print $2}' | xargs svn add |
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 | |
/** | |
* Helper function since this function doesn't exist in core | |
*/ | |
function remove_post_terms( $post_id, $terms_to_remove, $taxonomy ) { | |
$terms_to_remove = array_map( 'intval', $terms_to_remove ); | |
array_filter( $terms_to_remove, function( $term ) { return ! empty( $term ); } ); | |
// Get the existing terms and only keep the ones we don't want removed |
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( 'wp_enqueue_scripts', function() { | |
wp_register_style( 'parent-theme', get_template_directory_uri() . '/style.css' ); | |
wp_enqueue_style( 'child-theme', get_stylesheet_uri(), array( 'parent-theme' ) ); | |
} ); |
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_filter( 'allowed_http_origins', 'my_add_origins' ); | |
function my_add_origins( $origins ) { | |
$origins[] = 'http://www.example.com'; // this will add www.example.com to the list of allowed origins when send_origin_headers() is called | |
return $origins; | |
} |
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 dump_rewrite_rules() { | |
$tmp_file = '/tmp/rewrite_rule_dump.txt'; // define filename here if needed | |
if ( !touch( $tmp_file ) || !is_writeable( $tmp_file ) ) { | |
error_log( 'dump_rewrite_rules: The file ' . $tmp_file . ' is not writable. Please check the permissions.' ); | |
return; | |
} | |
global $wp_rewrite; | |
$rules = var_export( $wp_rewrite, true ); |
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( 'wp_enqueue_scripts', 'my_parent_register_scripts', 1 ); | |
function my_parent_register_scripts() { | |
// register scripts here | |
} | |
add_action( 'wp_enqueue_scripts', 'my_parent_enqueue_scripts' ); |
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( 'wp_enqueue_scripts', 'my_enqueue_scripts' ); | |
function my_enqueue_scripts() { | |
wp_register_style( 'parent-theme', get_template_directory_uri() . '/style.css' ); | |
wp_enqueue_style( 'child-theme', get_stylesheet_uri(), array( 'parent-theme' ) ); | |
} |
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
Index: zoninator.php | |
=================================================================== | |
--- zoninator.php (revision 67407) | |
+++ zoninator.php (working copy) | |
@@ -164,10 +164,11 @@ | |
case 'insert': | |
case 'update': | |
+ $zone_id = $this->_get_post_var( 'zone_id', 0, 'absint' ); | |
+ |