Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
strangerstudios / pmpro_is_level_expiring_soon_yes_on_levels_page.php
Created September 13, 2017 14:21
Show a renew link instead of Your Level for recurring subscriptions on the levels page with Paid Memberships Pro.
/*
Show a renew link instead of Your Level
for recurring subscriptions on the levels page.
Add this code to a custom plugin.
*/
function pmpro_is_level_expiring_soon_yes_on_levels_page($expiring) {
//only adjust this on the levels page so we don't mess anything up
global $pmpro_pages;
if(!is_admin() && !empty($pmpro_pages) && is_page($pmpro_pages['levels']))
@renshuki
renshuki / recalculate-acf-locations.php
Last active July 7, 2023 01:15 — forked from RadGH/recalculate-acf-locations.php
Update ACF location fields (Google Map) after WP All Import CSV import (Google map update not triggered correctly) - Credits: https://support.advancedcustomfields.com/forums/topic/how-to-update-google-map-latitudelongitude-after-importing-using-address/
<?php
global $ld_recalc;
global $geolocate_api_key;
$geolocate_api_key = "YOUR_GOOGLE_GEOLOCATE_API_KEY";
$ld_recalc = array(
'posts_per_run' => 16,
'post_types' => array( 'distributor' ),
@caspg
caspg / 1_searchbar_live.ex
Last active November 6, 2024 11:04
Example of real-time search bar implementation in Phoenix LiveView and Tailwind. Working example on https://travelermap.net/parks/usa
defmodule TravelerWeb.SearchbarLive do
use TravelerWeb, :live_view
alias Phoenix.LiveView.JS
alias Traveler.Places
def mount(_params, _session, socket) do
socket = assign(socket, places: [])
{:ok, socket, layout: false}
end