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 | |
// Form #215 | |
// Start date field id: #18 | |
// End date field id: #19 | |
// Validation only applies to the end date, but checks the value of both dates | |
add_filter('gform_field_validation_215_19', 'rs_validate_two_gf_date_fields', 10, 4); | |
function rs_validate_two_gf_date_fields( $result, $value, $form, $field ) { | |
$start_date_field_id = 18; |
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 | |
/** | |
* Before the block template is displayed, replace it with a different block template. | |
* | |
* IMPORTANT: You must create the block template through the editor: Templates > Add New | |
* | |
* @param string $template | |
* | |
* @return 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 | |
/* | |
Plugin Name: RS Sideload Test | |
Description: Test your website's ability to upload images from a URL using the function `rs_upload_from_url()`. To get started, visit your site url ending in `?rs_9e86e751eacb` to run the tool. See Gist at the plugin URL below for more information. | |
Plugin URI: https://gist.github.com/RadGH/be30af96617b13e7848a4626ef179bbd | |
Author: Radley Sustaire | |
Author URI: https://gist.github.com/RadGH | |
Version: 1.3.1 | |
*/ |
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
// Result: https://radleysustaire.com/s3/d87fe5/chrome | |
// Enqueue this script in PHP during the action "enqueue_block_editor_assets": | |
// $deps = array('wp-element', 'wp-hooks'); | |
// wp_register_script( 'rs-download-block-editor', RSD_URL . '/assets/block-editor.js', $deps ); | |
// This filter replaces the icon of any block with the prefix "rs-downloads/" using a custom SVG icon | |
wp.hooks.addFilter( | |
'blocks.registerBlockType', | |
'rs-downloads/modify_icon', |
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 | |
/* | |
Plugin Name: RS Import Thumbnails | |
Description: Import thumbnails to your posts using the first image in the post content. To use this tool add to the end of your site url: ?rs_import_thumbnails_2023318_2330 | |
Version: 1.0 | |
Author: Radley Sustaire | |
Author URI: https://radleysustaire.com/ | |
*/ | |
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 | |
/** | |
* Create an HTML link using a phone number. | |
* Supports international numbers by preserving common symbols. | |
* Supports an optional extension displayed after the link. | |
* | |
* @param string $phone | |
* | |
* @return 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 | |
/** | |
* Gets gravity form entries for the given user. This includes entries where the user was logged in when they submitted the entry, and entries | |
* that were used to create their account with the GF User Registration Addon. | |
* | |
* @param $user_id | |
* | |
* @return 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 | |
// 1/3) Usage: | |
$entry_id = 100; // usually provided in a filter, if so you can remove this line. | |
$entry = GFAPI::get_entry( $entry_id ); // get the entry, if this was provided in a filter you can remove this line. | |
$field_id = 35; // field ID can be found when field is selected while editing the form | |
$value = rs_gf_get_checked_boxes( $entry, $field_id ); | |
// 2/3) Example output: |
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
/** | |
* Convert RGB to Hex. Allows whitespace. If given hex, returns that hex. Alpha opacity is discarded. | |
* Supports formats: | |
* #fc0 | |
* #ffcc00 | |
* rgb( 255, 255, 255 ) | |
* rgba( 255, 255, 255, 0.5 ) | |
* rgba( 255 255 255 / 0.5 ) | |
*/ | |
function rgb_any_to_hex( orig ) { |
NewerOlder