Skip to content

Instantly share code, notes, and snippets.

@djrmom
djrmom / custom-hooks.php
Last active August 21, 2019 10:35
facetwp redirect on marker click
<?php
/**
* redirect to permalink on click of info marker instead of opening info window
* Use the_permalink as the only content of your map facet marker content setting
* https://d.pr/i/TTb4XW
*/
add_action( 'wp_footer', function() { ?>
<style>
.gm-style .gm-style-iw-a {display: none;}
</style>
@mgibbs189
mgibbs189 / functions.php
Created May 15, 2019 16:12
FacetWP - index GeoMyWP coordinates
<?php
/**
* Setup instructions:
*
* 1. Add the following code to your (child) theme's functions.php
* 2. Create a new facet named "location"
* 3. Set the facet type to "Proximity"
* 4. Set the facet's Data source to "Post Type" (as a placeholder)
* 5. Save and re-index
*/
@mgibbs189
mgibbs189 / functions.php
Created March 11, 2019 13:27
Add "Load more" button after WooCommerce products
<?php
/* add to your (child) theme's functions.php */
add_action( 'woocommerce_after_shop_loop', function() {
?>
<button class="fwp-load-more">Load more</button>
<?php
} );
@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 );
@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}]},
@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" ){
@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",
@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() {
@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') ) );
}
<?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
*/