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( 'rest_prepare_post', __NAMESPACE__ . '\add_featured_image_data_to_rest', 70, 3 ); | |
/** | |
* Format the possible featured image metadata in the REST API response. | |
* | |
* @param WP_REST_Response $response The response object. | |
* @param WP_Post $item The original post object. | |
* @param WP_REST_Request $request The request used to generate the response. | |
* |
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 confirm_css_unit( $string ) { | |
// First check for a null or allowed strings. | |
if ( empty( $string ) || null === $string || in_array( $string, [ 'auto', 'fit-content', 'inherit' ] ) ) { | |
return $string; | |
} | |
// Pull out the numerical portion. | |
$value = preg_replace( '~\D~', '', $string ); |
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 | |
/** | |
* WooCommerce Upgrade Test Suite | |
* | |
* A set of acceptance tests for a standard WooCommerce store. | |
* | |
* https://gist.github.com/norcross/4d45f1902bfb2f1f4cf79997a47d9d03 | |
*/ | |
// It'll error out sometimes without this ¯\_(ツ)_/¯ . |
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 to work with Wordpress admin notices | |
* | |
* @example | |
* Notice::success('All is good!'); | |
* | |
* @example | |
* Notice::warning('Do something please.', 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 | |
/** | |
* If we requested the log file, grabit and spit it out. | |
* | |
* @return HTML | |
*/ | |
function rkv_adminbar_display_debug_log() { | |
// Bail without the query string or not on admin. | |
if ( ! is_admin() || empty( $_GET['viewlog'] ) ) { |
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( 'gppro_webfont_stacks', 'dpp_add_nunito_font', 50 ); | |
/** | |
* Add the Nunito font to the webfont data stack. | |
* | |
* @param array $webfonts The existing data array. | |
* | |
* @return array $webfonts The modified data array. | |
*/ |
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( 'authenticate', 'rkv_disable_username_logins', 20, 3 ); | |
/** | |
* Disable admin username and redirect to Google (or another site). | |
* | |
* @param object $user The WP_User object. | |
* @param string $username The entered username. | |
* @param string $password The entered password. | |
* |
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( 'pre_get_avatar', 'rkv_remove_avatar_from_list', 10, 3 ); | |
/** | |
* Remove the avatars from just the admin user list table. | |
* | |
* @param string $avatar HTML for the user's avatar. Default null. | |
* @param mixed $id_or_email The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash, | |
* user email, WP_User object, WP_Post object, or WP_Comment object. | |
* @param array $args Arguments passed to get_avatar_url(), after processing. | |
* |
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 | |
/** | |
* set up some quick links for the admin bar | |
* | |
* @param WP_Admin_Bar $wp_admin_bar [description] | |
* @return [type] [description] | |
*/ | |
function rkv_admin_bar_static( WP_Admin_Bar $wp_admin_bar ) { |
NewerOlder