Add Auto Sizes to Lazy Loaded images (copy)

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

MemberPress: Changes Product Image on the Checkout Page (copy)

function mepr_custom_checkout_image() { ?> (function($) { $(document).ready(function() { // Select the product image on the checkout page and change its source to a new image URL $(“.mp-table > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > img:nth-child(1)”).attr(“src”,”https://airfryerkogebogen.dk/wp-content/uploads/2024/11/airfryerkogebogen.png”); }); })(jQuery); <?php } add_action(…Continue reading

Remove HealthAndBeautyBusiness Schema

add_filter(‘aioseo_schema_output’, ‘aioseo_remove_health_and_beauty_business_schema’); function aioseo_remove_health_and_beauty_business_schema($graphs) { foreach ($graphs as $index => $value) { if (isset($value[‘@type’]) && $value[‘@type’] === ‘HealthAndBeautyBusiness’) { unset($graphs[$index]); } } return $graphs; }Continue reading

S7 – Set all posts to full width in Divi settings

function custom_divi_layout_replacer_menu() { add_menu_page( ‘Divi Layout Replacer’, ‘Divi Layout Replacer’, ‘manage_options’, ‘divi-layout-replacer’, ‘custom_divi_layout_replacer_page’, ‘dashicons-editor-table’, 20 ); } add_action(‘admin_menu’, ‘custom_divi_layout_replacer_menu’); function custom_divi_layout_replacer_page() { global $wpdb; ?> Divi Layout Replacer This tool allows you to search for posts with a specific layout…Continue reading

How to Display a List of WPForms Using a Shortcode

/** * Create shortcode to display all form titles in a list. * * Basic usage: [wpforms_all_forms] * * @link https://wpforms.com/developers/how-to-display-a-list-of-wpforms-using-a-shortcode/ */ add_shortcode(‘wpforms_all_forms’, function() { $args = [ ‘post_type’ => ‘wpforms’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ]; $posts =…Continue reading

How to Change the Error Text for Failed Submissions

/** * Change the error text message that appears. * * @link https://wpforms.com/developers/how-to-change-the-error-text-for-failed-submissions/ */ function wpf_translated($translated_text, $text, $domain) { // Bail early if it’s not a WPForms string. if ($domain !== ‘wpforms-lite’) { return $translated_text; } // Compare against the…Continue reading