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 | |
/** | |
* Display our notice and hide default. | |
*/ | |
function action_admin_notices() { | |
$screen = get_current_screen(); | |
if ( ! in_array( $screen->id, array( 'post', 'page' ), true ) ) { | |
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
<?php | |
/** | |
* Call a function on each combination of the values of multiple arrays. | |
* | |
* First parameter should by a callable function name or an array with the | |
* following key value pairs: | |
* | |
* 'callback' string A callable function or method name. | |
* 'break_early' boolean True if function can quit early. | |
* 'break_on' mixed Value that if returned by callback will short-circuit iteration. |
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 | |
// todo store as an option and address all concerns at https://core.trac.wordpress.org/ticket/14671 | |
function helper_count_required_args ( $function ) { | |
static $arg_counts = array(); | |
$key = is_scalar( $function ) ? $function : serialize( $function ); | |
if ( isset( $arg_counts[$key] ) ) { | |
return $arg_counts[$key]; | |
} | |
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 | |
// This section is entirely for testing filters and other behavior peculiar to the VIP environment. | |
if ( isset( $post->post_content ) ) { | |
$urls = $this->get_content_images( $post->post_content ); | |
$image_ids = []; | |
foreach ( $urls as $url ) { | |
$image_ids[] = $this->get_attachment_id( $url ); | |
} |
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 | |
/** | |
* Log messages, timestamps and values throughout a page load and return them at the end for output at the bottom of | |
* the page or for storage with a single database touch. | |
* | |
* @param string $message Log message. | |
* @param mixed $value Log value. | |
* @param string $format Optional. Return type. Either text or array. Default array. | |
* | |
* @return array|string |
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 report_args() { | |
echo "\n----------" . current_filter() . "\n"; | |
$args = func_get_args(); | |
var_export( $args ); | |
return $args[0]; | |
} | |
add_filter( 'nav_menu_item_args', __NAMESPACE__ . '\report_args', 10, 3 ); |
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 | |
/** | |
* Allow italics to be used in the sitename. | |
* | |
* @action bloginfo | |
* | |
* @param mixed $output The requested non-URL site information. | |
* @param mixed $show Type of information requested. | |
* | |
* @return mixed |
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 | |
add_filter( 'the_category', function( $thelist, $separator, $parents ) { | |
return = preg_replace( '/<a[^>]*>([\w\s-]*)<\/a>/', '<span>$1</span>', $thelist ); | |
}, 10, 3 ); |