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 | |
/* | |
Plugin Name: RS ACF Specific Term Location | |
Description: Adds a custom ACF location rule "Specific Term". It lets you restrict a field group to show only for a specific term when editing a term in the backend. | |
Version: 1.0.2 | |
*/ | |
// category ancestor location rule | |
function rs_acf_location_types_specific_term( $choices ) { | |
if ( !isset( $choices['Forms']['specific_term_id'] ) ) { |
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 | |
// Posted for Stack Overflow: | |
// @see https://stackoverflow.com/questions/77198717/temporary-global-sale-price-discount-for-all-products-in-woocommerce | |
// Note this code supports WooCommerce Subscriptions. | |
// If you aren't using that, you need to remove the references to WC_Subscriptions_Product and the related functions. | |
// 1. Custom function that should return true if the user is a member. | |
// Modified to just check if you are an admin, but you could change this to look at your previous subscriptions |
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 | |
// Reorder admin menu | |
add_filter( 'custom_menu_order', '__return_true' ); | |
add_filter( 'menu_order', 'my_theme_reorder_admin_menu' ); | |
function my_theme_reorder_admin_menu() { | |
return array( | |
'index.php', | |
'edit.php?post_type=page', |
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 | |
// 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 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 | |
/** | |
* 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 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 | |
/* | |
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 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
// 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 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 | |
/* | |
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 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 | |
/** | |
* 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 |
NewerOlder