Skip to content

Instantly share code, notes, and snippets.

@screwLock
screwLock / gist:628ae1092a0b66a44527a53add551b87
Created May 17, 2018 19:37 — forked from bradp/gist:4999343
WordPress function to convert address to Lat/Long
<?php
function brrad_geocode($street_address,$city,$state){
$street_address = str_replace(" ", "+", $street_address); //google doesn't like spaces in urls, but who does?
$city = str_replace(" ", "+", $city);
$state = str_replace(" ", "+", $state);
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=$street_address,+$city,+$state&sensor=false";
$google_api_response = wp_remote_get( $url );
@screwLock
screwLock / Memberpress Customizations
Created May 17, 2018 11:02 — forked from lisaleague/Memberpress Customizations
Memberpress limit number of signups for product
<?php
/*
Plugin Name: Memberpress Customizations
Plugin URI: http://www.qpractice.com/
Description: Customizations for Memberpress
Author: Lisa League
Version: 1.0
Author URI: http://www.qpractice.com/
*/
<?php
$user_id = get_current_user_id();
if ($user_id == 0) {
// echo 'You are logged in as user '.$user_id; // DEBUGGING
echo "&nbsp;";
} else {
// echo 'You are not logged in.'; // DEBUGGING
@screwLock
screwLock / memberpress_mailchimp_mergetags.php
Created May 17, 2018 06:38 — forked from noameppel/memberpress_mailchimp_mergetags.php
Hooks in to MemberPress $args array before sending new member info to MailChimp.
<?php
/**
* [cleanforest_mepr_add_my_tags]
* Hooks in to MemberPress $args array before sending new member info to MailChimp.
* Used to add custom MERGETAG information.
*/
function cleanforest_mepr_add_my_tags($args, $contact)
{
// MMERGE3 State
$state = get_user_meta($contact->ID, 'mepr-address-state', true);
@screwLock
screwLock / generate-blog-domain-name.php
Created May 4, 2018 03:59
Automatically generate subdomain for new WordPress Multisite blogs
<?php
// When you create a new WordPress Multisite blog from the admin area, you have
// to enter three things:
// 1. Site address (subdomain or folder name)
// 2. Site title
// 3. Admin email
// For my purposes I wanted the site address to be automatically generated from