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
/** | |
* REMOVE Gutenberg Styles auto added by wordpress. | |
* | |
*/ | |
if(! is_admin()) | |
add_action ( 'init', 'remove_wp_block_library_css', PHP_INT_MAX ); | |
function remove_wp_block_library_css(){ | |
wp_dequeue_style( 'wp-block-library' ); | |
wp_dequeue_style( 'wp-block-library-theme' ); |
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 | |
/* | |
code is broken. | |
Either wordpress completely discards the paging request variables, or sends a 404. | |
*/ | |
function get_story_loop(){ | |
global $wp_query; | |
$post_query = $wp_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
function _get_all_meta_values($key) { | |
global $wpdb; | |
$result = $wpdb->get_col( | |
$wpdb->prepare( " | |
SELECT DISTINCT pm.meta_value FROM {$wpdb->postmeta} pm | |
LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id | |
WHERE pm.meta_key = '%s' | |
AND p.post_status = 'publish' | |
ORDER BY pm.meta_value", | |
$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
function createRoundedRectPath(x, y, width, height, radius) { | |
return ( | |
// Move to position, offset by radius in x direction | |
"M" +(x + radius) + "," + y | |
// Draw a horizontal line to the top right curve start | |
+ "h" + (width - 2 * radius) | |
// Draw the top right corner curve | |
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius | |
// Draw a vertical line to the bottom right corner | |
+ "v" + (height - 2 * radius) |
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 | |
/** | |
* prevent anyone other than admins from editing other user's passwords. | |
* disable password change fields for anyone other than admins. | |
* @since 0.0.2 removed part about editing own profile, because the password fields don't show there anyway. | |
* @see https://developer.wordpress.org/reference/hooks/show_password_fields/ show_password_fields hook documentation | |
* @param bool $default the current setting; default = true. | |
* @param object $profileuser, the user currently being edited. | |
*/ | |
add_filter('show_password_fields', function($default, $profileuser){ |
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 | |
/** | |
* Disables loading of complianz cookie banner and blocking of cookies | |
* while in Oxygen Builder. Uses early-firing compliance hook. | |
* simply checks the request for the ct_builder query var. | |
* */ | |
add_filter( | |
'cmplz_site_needs_cookiewarning', | |
function ( $cookiewarning_required) { |
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 | |
/** | |
* In the Stripe Gravity Forms Addon, the api test-mode is all-or-nothing. | |
* sometimes you need more granular control; eg testing a form on a production site, | |
* while leaving other forms operational. | |
* This function allows you to set the api to test mode for specific user capabilities. | |
* you can also specify a form you want to test, while leaving all other forms live. | |
* @param integer $formID | |
* @param string the user cap. default 'manage_options' | |
* @example stripe_api_mode_to_test(); //admin will be able to use all forms in test mode. |
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 | |
/** | |
* Save the image on the server. | |
*/ | |
function save_image( $base64_img, $title ) { | |
// Upload dir. | |
$upload_dir = wp_upload_dir(); | |
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR; |
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
add_action( 'gform_after_create_post', 'gf_add_to_media_library', 10, 3 ); | |
/** | |
* Save file upload fields under custom post field to the library | |
* | |
* @param $post_id The post identifier | |
* @param $entry The entry | |
* @param $form The form | |
*/ |
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 | |
/** | |
* Gravity Wiz // Gravity Forms // Map Submitted Field Values to Another Field | |
* | |
* Usage | |
* | |
* 1 - Enable "Allow field to be populated dynamically" option on field which should be populated. | |
* 2 - In the "Parameter Name" input, enter the merge tag (or merge tags) of the field whose value whould be populated into this field. | |
* | |
* Basic Fields |
NewerOlder