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 ) { |
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 | |
/** | |
* When updating a post, user, or term, ensure specific fields have a blank entry in the database even when null. | |
* | |
* @param $object_id | |
* @param null $type | |
* @param null $subtype | |
*/ | |
function rs_insert_missing_meta_keys_on_save( $object_id, $type = null, $subtype = null ) { |
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 | |
// Make every gravity form field add its input type as a class. | |
// Example (added class: gfield-type-radio): | |
// fieldset id="field_136_31" class="gfield gfield-type-radio ..." | |
// Some other types: name, email, html, select, ... | |
function aa_add_input_type_gravity_forms( $form ) { | |
foreach ( $form['fields'] as $field ) { | |
if ( $field instanceof GF_Field ) { | |
$field->cssClass .= 'gfield-type-' . $field->get_input_type(); |
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
{"0":{"title":"Editable Form","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Submit","imageUrl":"","width":"auto","location":"bottom","layoutGridColumnSpan":12},"fields":[{"type":"name","id":1,"formId":12,"label":"Name","adminLabel":"","isRequired":false,"size":"large","errorMessage":"","visibility":"visible","nameFormat":"advanced","inputs":[{"id":"1.2","label":"Prefix","name":"","autocompleteAttribute":"honorific-prefix","choices":[{"text":"Dr.","value":"Dr."},{"text":"Miss","value":"Miss"},{"text":"Mr.","value":"Mr."},{"text":"Mrs.","value":"Mrs."},{"text":"Ms.","value":"Ms."},{"text":"Prof.","value":"Prof."},{"text":"Rev.","value":"Rev."}],"isHidden":false,"inputType":"radio"},{"id":"1.3","label":"First","name":"fname","autocompleteAttribute":"given-name"},{"id":"1.4","label":"Middle","name":"","autocompleteAttribute":"additional-name","isHidden":false},{"id":"1.6","label":"Last","name":"lname","autocompleteAttribute":"family-name"},{"id":"1.8" |
NewerOlder