if(!function_exists(‘wp_get_attachment’) ) : function wp_get_attachment( $attachment_id ) { $attachment = get_post($attachment_id); if( $attachment ) { $caption = function_exists(‘aioseoImageSeo’) ? aioseoImageSeo()->tags->replaceTags(aioseo()->options->image->caption->format, $attachment->ID, ‘caption’) : $attachment->post_excerpt; return array( ‘alt’ => get_post_meta($attachment->ID, ‘_wp_attachment_image_alt’, true), ‘caption’ => $caption, ‘description’ => $attachment->post_content, ‘href’ => esc_url(get_permalink($attachment->ID)),…Continue reading
add_filter( ‘tasty_pins_old_attributes_migration_content’, function ( $content, $post ) { if ( str_contains( $content, ‘WP Tasty’ ) ){ update_post_meta( $post->ID, ‘wp-tasty-here’, true ); } // You can also change $content to modify the contents of the post. return $content; }, 10, 2…Continue reading
// Include Simple HTML DOM parsing library if needed (you can also manually include it if necessary) if (!function_exists(‘file_get_html’)) { function file_get_html($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $output = curl_exec($ch); curl_close($ch); return…Continue reading
// Include Simple HTML DOM parsing library if needed (you can also manually include it if necessary) if (!function_exists(‘file_get_html’)) { function file_get_html($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $output = curl_exec($ch); curl_close($ch); return…Continue reading
/** * Returns the current year. * * @return string Current year in YYYY format. */ function get_current_year() { return date(‘Y’); } /** * Shortcode to display the current year. * * @return string HTML span with current year. */…Continue reading
function convert_to_webp($file) { $file_path = $file[‘file’]; $file_type = $file[‘type’]; // Only for JPEG, PNG, and GIF images if (in_array($file_type, [‘image/jpeg’, ‘image/png’, ‘image/gif’, ‘image/jpg’])) { $webp_path = preg_replace(‘/\.(jpe?g|png|gif)$/i’, ‘.webp’, $file_path); // Check if the GD library is available if (!function_exists(‘gd_info’)) {…Continue reading
add_action(‘wp_footer’, ‘send_all_datalayer_events_to_clarity’); function send_all_datalayer_events_to_clarity() { ?>Continue reading
function mepr_custom_is_domain_whitelisted() { $whitelist = array( “domain.com, domain1.com” ); //comma-separated list of domains $domain = parse_url( $_SERVER[ ‘HTTP_REFERER’ ], PHP_URL_HOST ); if ( !empty($domain ) && in_array( $domain, $whitelist ) ) { return true; //Exclude from paywall } return false;…Continue reading
//Turn off Auto rebill for offline gateway if a transactions expires function turn_off_auto_rebill_offline_gateway( $txn, $sub_status ) { if ( $txn->payment_method() instanceof MeprArtificialGateway && $sub = $txn->subscription() ) { $sub->status = MeprSubscription::$cancelled_str; $sub->store(); } } add_action( ‘mepr-transaction-expired’, ‘turn_off_auto_rebill_offline_gateway’, 9, 2 );…Continue reading