Skip to content

Instantly share code, notes, and snippets.

@chrisguitarguy
chrisguitarguy / wp-registration-keys.php
Created August 30, 2011 20:28
Only lets users with an invite code register for a WordPress site.
<?php
/*
Plugin Name: WP Invite Codes
Plugin URI: http://pmg.co/
Description: Makes wordpress an invite only community.
Version: n/a
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
*/
@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@jameskoster
jameskoster / functions.php
Created March 6, 2013 16:32
WooCommerce - declare WooCommerce support in theme
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
<?php
/*
Plugin Name: WP Invite Codes
Plugin URI: http://pmg.co/
Description: Makes wordpress an invite only community.
Version: n/a
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
*/
@ultimatemember
ultimatemember / gist:296161825d8127fa28fc
Last active February 28, 2018 15:59
Stop registration if customer_code field does not equal ABCDE
add_action('um_submit_form_errors_hook', 'check_customer_code', 100 );
function check_customer_code( $args ){
if ( isset( $args['customer_code'] ) && $args['customer_code'] != 'ABCDE' )
exit( wp_redirect( add_query_arg('err', 'invalid_customer_code') ) );
}
@bekarice
bekarice / wc-free-checkout-fields.php
Last active October 31, 2021 19:10
Simplify WooCommerce checkout fields for free checkouts
<?php // only copy if needed
/**
* Removes coupon form, order notes, and several billing fields if the checkout doesn't require payment.
*
* REQUIRES PHP 5.3+
*
* Tutorial: http://skyver.ge/c
*/
function sv_free_checkout_fields() {
@champsupertramp
champsupertramp / Ultimate Member - adding custom fields in account page and tab
Last active October 14, 2023 19:18
Ultimate Member - adding custom fields in account page and tab
<?php
/* Add fields to account page */
add_action('um_after_account_general', 'showExtraFields', 100);
function showExtraFields()
{
$custom_fields = [
"alternate_email" => "Permanent E-mail Address",
"major" => "Major",
"minor" => "Minor",
"gpa" => "GPA",
@champsupertramp
champsupertramp / Allow everyone to upload profile and cover photos on frontend pages
Created September 21, 2016 06:04
Ultimate Member - Allow everyone to upload profile and cover photos on front-end pages.
/**
* Ultimate Member - Customization
* Description: Allow everyone to upload profile and cover photos on front-end pages.
*/
add_filter("um_user_pre_updating_files_array","um_custom_user_pre_updating_files_array", 10, 1);
function um_custom_user_pre_updating_files_array( $arr_files ){
if( is_array( $arr_files ) ){
foreach( $arr_files as $key => $details ){
if( $key == "userphoto" ){
@djrmom
djrmom / custom-hooks.php
Created July 13, 2018 12:46
facetwp map styles
<?php
/** filtering map styles
** see https://developers.google.com/maps/documentation/javascript/style-reference
*/
add_filter( 'facetwp_map_init_args', function( $settings) {
$settings['init']['styles'] = json_decode( '[{"featureType":"all","elementType":"labels.text.fill","stylers":[{"color":"#ffffff"}]},{"featureType":"all","elementType":"labels.text.stroke","stylers":[{"color":"#000000"},{"lightness":13}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#000000"}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#144b53"},{"lightness":14},{"weight":1.4}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#08304b"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#0c4152"},{"lightness":5}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#000000"}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#0b434f"},{"lightness":25}]},
@djrmom
djrmom / custom-hooks.php
Created November 28, 2018 12:56
facetwp add lables to google map icons
<?php
/** add map facet icon labels **/
add_filter( 'facetwp_map_marker_args', function( $args, $post_id ) {
$args['label'] = esc_html( get_the_title( $post_id) );
return $args;
}, 10, 2 );