Fix Image Caption Rendering Issue Caused by WPResidence Theme

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 post meta if content has WP Tasty

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

NSB News and Events Aggregator

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

NSB News and Events Aggregator

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

Show more Landings

document.addEventListener(“DOMContentLoaded”, function () { // Get all Read More buttons const readMoreButtons = document.querySelectorAll(‘.read-more’); readMoreButtons.forEach(button => { button.addEventListener(‘click’, function (event) { event.preventDefault(); const feature = this.closest(‘.feature’); const longDesc = feature.querySelector(‘.long-desc’); const shortDesc = feature.querySelector(‘.short-desc’); if (longDesc.style.display === “none”) { longDesc.style.display…Continue reading

Copyright & Current Year Shortcodes

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

Smart convert images to webp

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

MemberPress: Whitelist Domains

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

MemberPress: Turn Off Auto-Rebill for Offline Gateway

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