Network Metrics Cards [AT&T]

function render_att_darkstar_metrics_cards($atts) { // Fetch custom fields $custom_fields = get_post_meta(get_the_ID()); $city = isset($custom_fields[‘city’][0]) ? $custom_fields[‘city’][0] : ‘Unknown City’; $zip_code = isset($custom_fields[‘zip_code’][0]) ? $custom_fields[‘zip_code’][0] : ‘00000’; // Helper function to safely get field values if (!function_exists(‘get_field_value’)) { function get_field_value($fields, $key, $default…Continue reading

[AT&T] Coverage Map

// Shortcode to display Zip Code Coverage Map with Optimized GeoJSON Loading (Lazy-Loaded) function att_coverage_map_shortcode() { // Retrieve current post ID and its custom ‘zip_code’ $post_id = get_the_ID(); $zip_code = get_post_meta($post_id, ‘zip_code’, true); $avg_dl = get_post_meta($post_id, ‘att_mean_download_kbps’, true); $avg_dl_formatted =…Continue reading

[Verizon] Coverage Map

// Shortcode to display Zip Code Coverage Map with Optimized GeoJSON Loading (Lazy-Loaded) function verizon_coverage_map_shortcode() { // Retrieve current post ID and its custom ‘zip_code’ $post_id = get_the_ID(); $zip_code = get_post_meta($post_id, ‘zip_code’, true); $avg_dl = get_post_meta($post_id, ‘verizon_mean_download_kbps’, true); $avg_dl_formatted =…Continue reading

Nearby Stores Maps

function generate_map_of_nearby_stores() { // Get current post ID $post_id = get_the_ID(); // Retrieve the zip code, city, and state from custom fields $zip_code = get_post_meta($post_id, ‘zip_code’, true); $city = get_post_meta($post_id, ‘city’, true); $state = get_post_meta($post_id, ‘state’, true); // If required…Continue reading

set cookies for the blog and pass it during account creation later on

function set_usm_utm_cookie() { if (!isset($_COOKIE[‘utm_params’])) { $current_path = $_SERVER[‘REQUEST_URI’]; $path_parts = explode(‘?’, $current_path, 2); $current_path = $path_parts[0]; $utm_params_value = “utm_source=us_mobile&utm_medium=organic&utm_campaign=” . urlencode($current_path); // Set a cookie with URL-encoded path for 1 year setcookie(‘utm_params’, $utm_params_value, time() + (365 * 24 *…Continue reading

PHP custom Carousel

function enqueue_jquery() { if (!wp_script_is(‘jquery’, ‘enqueued’)) { wp_enqueue_script(‘jquery’); } } add_action(‘wp_enqueue_scripts’, ‘enqueue_jquery’);Continue reading

Change Author Slug

/**Change Author Slug */ function new_author_base() { global $wp_rewrite; $author_slug = ‘about’; $wp_rewrite->author_base = $author_slug; } add_action(‘init’, ‘new_author_base’);Continue reading

FC – Mejoras en el procesamiento de imágenes

//* Evitar que WP cree tamaños de imagen adicionales add_action(‘intermediate_image_sizes_advanced’, function ($sizes) { unset($sizes[‘1536×1536’]); // desactivar tamaño medio-grande x2 unset($sizes[‘2048×2048’]); // desactivar tamaño grande x2 return $sizes; }); //* Evitar que se creen los tamaños escalados add_filter(‘big_image_size_threshold’, ‘__return_false’, PHP_INT_MAX-20); //*…Continue reading

How to Store Field Values in the WPForms Entry

/** * Show values in Dropdown, checkboxes, and Multiple Choice. */ add_action( ‘wpforms_fields_show_options_setting’, ‘__return_true’ ); /** * Save choices ‘values’ instead of ‘labels’ for the fields with ‘Show values’ option enabled. * * @link https://wpforms.com/developers/how-to-store-field-values-in-the-wpforms-entry/ */ function wpf_dev_process_filter_choices_values( $fields, $entry,…Continue reading