Skip to content

Instantly share code, notes, and snippets.

View ajskelton's full-sized avatar

Anthony ajskelton

View GitHub Profile
@ajskelton
ajskelton / gravity-forms-email-blacklist.php
Created April 5, 2018 15:49
Gravity Forms email blacklist
add_filter( 'gform_field_validation', 'PREFIX_gravity_forms_blacklist', 10, 4 );
/**
* Added Validation check for email vs blacklist of free email accounts.
*
* @param $result array The validation result to be filtered
* @param $value string|array The field value to be validated
* @param $form object Current Form object
* @param $field object Current Field object
*
* @return mixed
@ajskelton
ajskelton / gist:915675de94d914bbadd9bcef965c3cbc
Created July 26, 2021 22:23
WordPress SQL Query for finding posts that have a specific acf value
SELECT * FROM wp_posts
LEFT JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id
WHERE wp_posts.post_status = 'publish'
AND wp_postmeta.meta_value = '%ACF_FIELD_VALUE%'
ORDER BY wp_posts.ID
@ajskelton
ajskelton / WP Customizer - Select
Last active June 24, 2021 19:36
Add a Select field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_select_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_select',
'default' => 'value1',
) );
$wp_customize->add_control( 'themeslug_select_setting_id', array(
'type' => 'select',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Select Option' ),
@ajskelton
ajskelton / WP Customizer - Color Control
Last active July 17, 2020 05:05
Add a Color Control field to the WordPress Customizer.
$wp_customize->add_setting( 'core_color_setting_id', array(
'sanitize_callback' => 'themeslug_sanitize_hex_color',
) );
$wp_customize->add_control(
new WP_Customize_Color_Control( $wp_customize, 'core_color_setting_id',
array(
'label' => __( 'Core Color Setting' ),
'description' => __( 'Select a color for something' ),
'section' => 'custom_section', // Add a default or your own section
@ajskelton
ajskelton / WP Customizer - URL
Last active May 5, 2020 15:01
Add a URL field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_url_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_url',
) );
$wp_customize->add_control( 'themeslug_url_setting_id', array(
'type' => 'url',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom URL' ),
'description' => __( 'This is a custom url input.' ),
@ajskelton
ajskelton / gist:b358fa7e58c303314f7b2fe962a651f8
Created April 6, 2020 15:36
Test for pages using a specific Page Template
function test_for_page_template() {
$args = array(
'post_type' => 'page',
'meta_query' => array(
array(
'key' => '_wp_page_template',
'value' => 'PAGETEMPLATE.php'
)
)
);
@ajskelton
ajskelton / WP Customizer - Date
Last active January 10, 2020 00:52
Add a Date field to the WordPress Customizer. Includes sanitize function for displaying date as '2016-10-25'.
$wp_customize->add_setting( 'date_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_date',
) );
$wp_customize->add_control( 'date_setting_id', array(
'type' => 'date',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Date' ),
'description' => __( 'This is a custom date control.' ),
@ajskelton
ajskelton / WP Customizer - Email
Last active September 1, 2019 04:31
Add a Email field to the WordPress Customizer.
$wp_customize->add_setting( 'themeslug_email_setting_id', array(
'capability' => 'edit_theme_options',
'default' => '',
'sanitize_callback' => 'themeslug_sanitize_email',
) );
$wp_customize->add_control( 'themeslug_email_setting_id', array(
'type' => 'email',
'section' => 'custom_section', // Required, core or custom.
'label' => __( 'Custom Email' ),
alias gtree='git log --graph --abbrev-commit --decorate --date=relative --format=format:'\''%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'\'' --all'
@ajskelton
ajskelton / gist:6eca1d026301a1690213a671c5e564bc
Last active January 30, 2019 18:50
Laravel Valet Local then Remote Images
location ~* .(png|jpe?g|gif|ico|svg)$ {
expires 24h;
log_not_found off;
root '/Users/USERNAME/.valet/Sites/mixpanel/’;
if (-f $request_filename) {
break;
}
try_files $uri $uri/ @production;
}