Remove custom trial for existing members

/** * Remove custom trial for existing members (when existing member changes levels/renews) * * title: Remove custom trial for existing memebrs. * layout: snippet * collection: checkout * category: membership-levels, trial * * You can add this recipe to…Continue reading

Disable Thumbnail Image Sizes

add_filter( ‘intermediate_image_sizes_advanced’, function( $sizes ) { // Disable specific thumbnail sizes, uncomment the ones you want to disable. // unset( $sizes[‘thumbnail’] ); // 150px x 150px // unset( $sizes[‘medium’] ); // 300px x 300px // unset( $sizes[‘medium_large’] ); // 768px…Continue reading

Add Auto Sizes to Lazy Loaded images

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr ) { if ( ! isset( $attr[‘loading’] ) || ‘lazy’ !== $attr[‘loading’] || ! isset( $attr[‘sizes’] ) ) { return $attr; } // Skip if attribute was already added. if ( false !== strpos( $attr[‘sizes’], ‘auto,’…Continue reading

Disable WordPress 6.5 Font Library

add_filter( ‘block_editor_settings_all’, function( $editor_settings ) { $editor_settings[‘fontLibraryEnabled’] = false; return $editor_settings; } ); // Disable the REST API for the font library. add_filter( ‘register_post_type_args’, function( $arg, $post_type ) { if ( ‘wp_font_family’ === $post_type || ‘wp_font_face’ === $post_type ) {…Continue reading

News title Character Limit

function truncate_html($html, $maxLength) { // Return early if the initial string is shorter than the maxLength if (strlen($html) loadHTML(mb_convert_encoding($html, ‘HTML-ENTITIES’, ‘UTF-8’), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); libxml_clear_errors(); // Use an XPath query to select all text nodes $xpath = new DOMXPath($dom); $textNodes…Continue reading

Loading custom templates

/** * Plugin Name: WPForms Custom Templates * Description: This plugin loads custom form templates. * Version: 1.0.0 */ /** * Load the templates. */ function wpf_load_custom_templates() { // Template code here } add_action( ‘wpforms_loaded’, ‘wpf_load_custom_templates’ );Continue reading