Duplicate Menus

// Function to duplicate a menu function duplicate_menu_action() { // Check if the action is to duplicate a menu if (isset($_GET[‘action’]) && $_GET[‘action’] === ‘duplicate_menu’ && isset($_GET[‘menu_id’])) { // Verify the user has the required capability if (!current_user_can(‘edit_theme_options’)) { wp_die(__(‘You…Continue reading

Wpallimport Time Stamp Converter

function convert_to_cst_for_import( $utc ) { if ( empty( $utc ) ) return ”; try { $dt = new DateTime( $utc, new DateTimeZone( ‘UTC’ ) ); $dt->setTimezone( new DateTimeZone( ‘America/Chicago’ ) ); // CST/CDT auto-handled return $dt->format( ‘Y-m-d H:i:s’ ); }…Continue reading

snip_FetchPriority version 10

add_action(‘template_redirect’, function () { ob_start(function ($html) { return preg_replace_callback( ‘#]+class=”[^”]*highfetchprio[^”]*”[^>]*)>#i’, function ($matches) { $img = $matches[0]; // ✅ Supprimer lazyload et attributs inutiles $img = preg_replace(‘#slazyload(ed)?#i’, ”, $img); $img = preg_replace(‘#sdata-lazy-[a-z]+=”[^”]*”#i’, ”, $img); // ✅ Supprimer anciens attributs $img =…Continue reading

snip_FetchPriority version 9

add_filter(‘wp_get_attachment_image_attributes’, function ($attr, $attachment) { if (!empty($attr[‘class’]) && strpos($attr[‘class’], ‘highfetchprio’) !== false) { // ✅ Optimisations LCP $attr[‘fetchpriority’] = ‘high’; $attr[‘loading’] = ‘eager’; $attr[‘decoding’] = ‘async’; // ✅ Suppression complète des traces de lazyload $attr[‘class’] = str_replace([‘lazyloaded’, ‘lazyload’], ”, $attr[‘class’]);…Continue reading

snip_FetchPriority version 8

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr, $attachment ) { if ( isset($attr[‘class’]) && strpos($attr[‘class’], ‘highfetchprio’) !== false ) { // Optimisations LCP $attr[‘fetchpriority’] = ‘high’; $attr[‘loading’] = ‘eager’; $attr[‘decoding’] = ‘async’; // Supprimer toute trace lazyload HTML $attr[‘class’] = str_replace([‘lazyloaded’, ‘lazyload’], ”,…Continue reading

Social Share Buttons (copy)

$post_url = urlencode( get_permalink() ); $post_title = urlencode( get_the_title() ); $facebook_url = “https://www.facebook.com/sharer/sharer.php?u=$post_url”; $x_url = “https://twitter.com/intent/tweet?url=$post_url&text=$post_title”; $linkedin_url = “https://www.linkedin.com/shareArticle?mini=true&url=$post_url&title=$post_title”; $social_buttons = ‘ ‘; echo $social_buttons; // Styles for the social sharing buttons. echo ‘ .social-share-buttons { display: flex; gap: 10px;…Continue reading

Social Share Buttons (copy)

$post_url = urlencode( get_permalink() ); $post_title = urlencode( get_the_title() ); $facebook_url = “https://www.facebook.com/sharer/sharer.php?u=$post_url”; $x_url = “https://twitter.com/intent/tweet?url=$post_url&text=$post_title”; $linkedin_url = “https://www.linkedin.com/shareArticle?mini=true&url=$post_url&title=$post_title”; $social_buttons = ‘ ‘; echo $social_buttons; // Styles for the social sharing buttons. echo ‘ .social-share-buttons { display: flex; gap: 10px;…Continue reading

snip_FetchPriority version 7

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr, $attachment ) { if ( isset($attr[‘class’]) && strpos($attr[‘class’], ‘highfetchprio’) !== false ) { // Optimisations LCP $attr[‘loading’] = ‘eager’; $attr[‘fetchpriority’] = ‘high’; $attr[‘decoding’] = ‘async’; // Supprimer toute trace lazyload HTML $attr[‘class’] = str_replace([‘lazyloaded’, ‘lazyload’], ”,…Continue reading