// Remove plugin deactivation for all users except ‘rubberduckers’ function rubberduckers_disable_plugin_deactivation($actions, $plugin_file, $plugin_data, $context) { // Get the current user $current_user = wp_get_current_user(); // Check if the current user’s username is NOT ‘rubberduckers’ if ($current_user->user_login !== ‘rubberduckers’) { // List…Continue reading
/* * */ function change_min_donation_text( $text, $amount ) { return ‘ ‘ . __( ‘The minimum donation for this campaign is ‘, ‘charitable’ ) . charitable_format_money( $amount, false, true ) . ‘. ‘; } add_filter( ‘charitable_donationa_amount_notice’, ‘change_min_donation_text’, 10, 2 );Continue reading
/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading
add_action( ‘jet-form-builder/media-field/before-upload’, /** * @var Jet_Form_BuilderRequestFieldsMedia_Field_Parser $parser */ function ( $parser ) { $class_name = $parser->get_context()->get_class_name(); // We need to add ‘allow-insert-attachments’ to the Advanced -> CSS Class Name option if ( ! $class_name || false === strpos( $class_name, ‘allow-insert-attachments’…Continue reading
// Remove query string from static resources function _remove_script_version( $src ){ $parts = explode( ‘?ver’, $src ); return $parts[0]; } add_filter( ‘script_loader_src’, ‘_remove_script_version’, 15, 1 ); add_filter( ‘style_loader_src’, ‘_remove_script_version’, 15, 1 ); // Turn off full screen editor if (is_admin())…Continue reading
// Remove wrap from images in ACF editor function gc_remove_p_tags_around_images($content) { $contentWithFixedPTags = preg_replace_callback(‘/ ((?:.(?!p>))*?)(]*>)?\s*(]+>)()?(.*?)/is’, function($matches) { // image and (optional) link: $image = $matches[2] . $matches[3] . $matches[4]; // content before and after image. wrap in unless it’s empty…Continue reading
// Custom Blocks add_action( ‘init’, ‘register_acf_blocks’ ); function register_acf_blocks() { register_block_type( __DIR__ . ‘/blocks/callout-list’ ); register_block_type( __DIR__ . ‘/blocks/blog-cta’ ); }Continue reading