Allow SVG Files Upload (copy)

/** * 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

webfontloader.js

// Add custom scripts function add_custom_script_webfont_loader_js() { wp_register_script( ‘webfontloader’, ‘https://cdnjs.cloudflare.com/ajax/libs/webfont/1.6.28/webfontloader.js’, array(), ‘1.6.28’, true ); wp_enqueue_script( ‘webfontloader’ ); } add_action( ‘wp_enqueue_scripts’, ‘add_custom_script_webfont_loader_js’ );Continue reading

fontfaceObserver.js

// Detect if web fonts are available function add_custom_script_font_face_observer_js() { wp_register_script( ‘fontface_observer’, ‘https://cdnjs.cloudflare.com/ajax/libs/fontfaceobserver/2.3.0/fontfaceobserver.standalone.js’, array(), ‘2.3.0’, true ); wp_enqueue_script( ‘fontface_observer’ ); } add_action( ‘wp_enqueue_scripts’, ‘add_custom_script_font_face_observer_js’ );Continue reading

masonry.js

// Add custom scripts function add_custom_script_masonry_js() { wp_register_script( ‘masonry’, ‘https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js’, array(), ‘4’, true ); wp_enqueue_script( ‘masonry’ ); } add_action( ‘wp_enqueue_scripts’, ‘add_custom_script_masonry_js’ );Continue reading

fullPage.js

// Add custom scripts function add_custom_script_fullpage_js() { wp_register_script( ‘fullpage’, ‘https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/4.0.29/fullpage.min.js’, array(), ‘4.0.29’, false ); wp_enqueue_script( ‘fullpage’ ); } add_action( ‘wp_enqueue_scripts’, ‘add_custom_script_fullpage_js’ );Continue reading

Untitled Snippet

function cwpai_parse_and_add_attributes( $atts ) { $atts = shortcode_atts( array( ‘entry_id’ => 0, ), $atts, ‘cwpai_parse_words’ ); if (empty($atts[‘entry_id’])) { return ”; } $entry = FrmEntry::getOne($atts[‘entry_id’]); if (!$entry) { return ”; } $user_input = $entry->metas[‘user_input’]; $user_input = strip_tags($user_input); $words = array_map(‘trim’,…Continue reading

Search and replace text strings

function replace_multiple_texts_on_the_fly($content) { // Array of text pairs to find and replace $text_pairs = array( ‘wp_code_guarantee_days’ => ’60’, ‘wp_code_dagen_garantie’ => ’60’, // Add more pairs as needed ); foreach ($text_pairs as $old_text => $new_text) { // Use str_replace for simple…Continue reading

Gravity Perks Easy Passthrough Edit Entry

class GPEP_Edit_Entry { private $form_id; private $delete_partial; private $passed_through_entries; private $refresh_token; private $process_feeds; public function __construct( $options ) { if ( ! function_exists( ‘rgar’ ) ) { return; } $this->form_id = rgar( $options, ‘form_id’ ); $this->delete_partial = rgar( $options, ‘delete_partial’,…Continue reading