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 | |
class CFO_Sanitize { | |
public static function sanitize_array( $fields, $data ) { | |
$clean_data = array(); | |
foreach ( $fields as $field ) { |
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 hm( $args ) { | |
$args = func_get_args(); | |
?> | |
<style> | |
.hm_debug { word-wrap: break-word; white-space: pre; text-align: left; position: relative; background-color: rgba(0, 0, 0, 0.8); font-size: 11px; color: #a1a1a1; margin: 10px; padding: 10px; margin: 0 auto; width: 80%; overflow: auto; -moz-border-radius: 5px; -webkit-border-radius: 5px; text-shadow: none; } |
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: HM Post Meta Revisions | |
Description: Register Revisions for meta keys. | |
Version: 1.0 | |
Author: Matthew Haines-Young (building on code from John Blackbourn) | |
*/ | |
class HM_Post_Meta_Revisions { |
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 | |
$_wp_registered_meta = array(); | |
/** | |
* Register meta key | |
* | |
* Supported arguments. | |
* label, field_type, sanitize_callback, auth_callback | |
* |
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
var CMBAdmin = function() { | |
var self = this; | |
self.init = function() { | |
self.$contentFormatSelect = jQuery('.field#content-format select' ).first(); | |
self.$metaboxes = self.$contentFormatSelecself.closest('.cmb_metabox'); | |
self.$videoField = jQuery('.field#content-video' ).closest('.cmb-row'); |
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 | |
/** | |
* Example Shortcode Classes. | |
* Shamelessly stolen fron Daniel Bachhuber | |
* | |
* Short-term - a wrapper around add_shortcode. | |
* Long-term - WP should use shortcode classes and povide compatability with old-style shortcodes. | |
*/ |
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: Split Shared Term Checker. | |
* Plugin URI: https://gist.github.com/mattheu/d821b76c4824fcfce6f5 | |
* Description: Check for shared terms and track when they are split. Find in the tools sub menu. | |
* Version: 0.0.1 | |
* Author: Matthew Haines-Young | |
* Author URI: http://matth.eu | |
* License: GPL2 | |
*/ |
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 | |
namespace DisableComments; | |
add_action( 'init', 'DisableComments\disable_comments_post_types_support' ); | |
add_filter( 'comments_array', 'DisableComments\disable_comments_hide_existing_comments', 10, 2 ); | |
add_action( 'admin_menu', 'DisableComments\disable_comments_admin_menu' ); | |
add_action( 'admin_init', 'DisableComments\disable_comments_admin_menu_redirect' ); | |
add_action( 'admin_init', 'DisableComments\disable_comments_dashboard' ); | |
add_action( 'init', 'DisableComments\disable_comments_admin_bar' ); |
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 | |
/** | |
* Downloads an external image and optionally attaches it to a post. | |
* | |
* Contains most of core's media_sideload_image() but returns an attachment ID instead of HTML. | |
* | |
* Note: this function does not validate the domain that the image is coming from. Please make sure | |
* to validate this before downloading the image. Should only pull down images from trusted sources. | |
* |
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 | |
/** | |
* Set default comment status to closed for woocommerce products. | |
*/ | |
add_filter( 'wp_insert_post_data', function( $data, $postarr ) { | |
// Auto draft is the status given to the initial post created | |
// when visiting the 'add new product' page in the WP-Admin. | |
// This still allows posts to be created programatically with comments open. |