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 helper_syntax_safe_include ( $file, $reset = false ) { | |
$key = sanitize_key( $file ); | |
if ( file_exists( $file) ) { | |
// found it, no more hunting | |
} elseif ( file_exists( trailingslashit( __DIR__ ) . ltrim( $file, '/' ) ) ) { | |
$file = trailingslashit( __DIR__ ) . ltrim( $file, '/' ); | |
} elseif ( file_exists( trailingslashit( get_template_directory() ) . ltrim( $file, '/' ) ) ) { | |
$file = trailingslashit( get_template_directory() ) . ltrim( $file, '/' ); |
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
class Better_Broken_Class extends Broken_Class { | |
private $parent = null; | |
function __construct ( $parent ) { | |
$this->parent = $parent; | |
} | |
function __call ( $name, $arguments ) { | |
if ( 'function_to_replace' === $name ) { | |
// do other stuff and return |
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
function fasc_find_shortcode() { | |
if ( ! isset( $_GET['findshortcode'] ) ) { | |
return; | |
} | |
global $wpdb; | |
$rows = $wpdb->get_results("SELECT ID, post_content FROM {$wpdb->posts} WHERE post_content LIKE '%[%'", ARRAY_N); |
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 remove_filter_in_class( $tag, $function_to_remove, $priority, $class ) { | |
if ( isset( $GLOBALS['wp_filter'][ $tag ][ $priority ] ) ) { | |
foreach ( $GLOBALS['wp_filter'][ $tag ][ $priority ] as $key => $function ) { | |
if ( is_array( $function['function'] ) | |
&& $function_to_remove === array_pop( $function['function'] ) | |
&& $class === get_class( array_pop( $function['function'] ) ) | |
) { | |
return remove_filter( $tag, $key, $priority ); | |
} |
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
function kill_pending_and_spam() { | |
$currentScreen = get_current_screen(); | |
if ( 'edit-comments' == $currentScreen->id ) { | |
global $wpdb; | |
$query = $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_approved = 0", '' ); | |
$wpdb->query( $query ); | |
$query = $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'", '' ); | |
$wpdb->query( $query ); |
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 My\Name\Space; | |
function action__init() { | |
$namespace = "translation-namespace"; | |
$single = __( 'Custom Post Type', $namespace ); | |
$plural = __( 'Custom Post Types', $namespace ); | |
register_post_type( 'namespace_custom_post_type', | |
array( |
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 My\Name\Space; | |
function action__init() { | |
$namespace = "translation-namespace"; | |
$single = __( 'Tag', $namespace ); | |
$plural = __( 'Tags', $namespace ); | |
register_taxonomy( 'name-space-tag', array( 'post', 'page' ), array( | |
'labels' => array( |
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
/*=========================================================================== | |
LINK EVENT LOCATION TAXONOMY AND POST TYPE | |
===========================================================================*/ | |
function action__transition_post_status( $new_status, $old_status, $post ) { | |
// make sure we actually have an event object | |
if ( null === ( $post = get_post( $post ) ) || 'event_loc' !== $post->post_type ) { | |
return; |
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
function namespace_divname_toggle(){ | |
this.className=("active"==this.className.substr(0, 6))?"":"active"; | |
} | |
document.querySelector('#divname').addEventListener('click', namespace_divname_toggle ) |
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
$response = wp_remote_post( | |
"https://api.freewheel.tv/services/upload/bvi.xml", | |
array( | |
'method' => 'POST', | |
'timeout' => 30, | |
'redirection' => 5, | |
'httpversion' => '1.0', | |
'headers' => array( | |
'X-FreeWheelToken' => 'MYAPIKEY', | |
'Expect' => ???? |