Skip to content

Instantly share code, notes, and snippets.

View thefrosty's full-sized avatar
🏖️
Santa Monica WordPress Developer

Austin Passy thefrosty

🏖️
Santa Monica WordPress Developer
View GitHub Profile
@thefrosty
thefrosty / wp-cl-customizer.php
Created February 22, 2016 17:49
Basic WordPress customizer setting.
<?php
namespace Passy;
add_action( 'customize_register', __NAMESPACE__ . '\\customize_register' );
function customize_register( WP_Customize_Manager $wp_customize ) {
$wp_customize->add_panel( 'custom_login_settings',
array(
@thefrosty
thefrosty / .htaccess
Created January 21, 2014 20:53
Can't seem to get this to work. Want all WordPress media files to point to the new Multisite install folder.
RewriteRule ^/wp-content/uploads/([0-9]{4})/([0-9]{2})/(.*)$ http://sub.domain.com/wp-content/uploads/sites/2/$1/$2/$3 [L,R=301]
@thefrosty
thefrosty / Get emails from a page.
Created May 24, 2013 17:33
I used this to scrape emails from a BuddyPress pending approvals page to email all users to verify non-spam.
var Values = [];
jQuery('#pw_pending_users a[href^="mailto:"]').each(function() {
var $this = jQuery(this);
Values.push($this.text());
});
console.log(Values.join(', '));
<?php
/*
Plugin Name: Easy Digital Downloads - Variable Pricing License Activation Limits
Plugin URL: http://easydigitaldownloads.com/extension/
Description: Limit the number of license activations permitted based on variable prices
Version: 1.0.3
Author: Pippin Williamson
Author URI: http://pippinsplugins.com
Contributors: mordauk
*/
@thefrosty
thefrosty / gist:5163269
Last active December 14, 2015 23:09
On each form submission I am saving an array in meta, and on form completion I am trying to update the meta. But since it's a multidimensional array I am trying to target only the current matching array to update "inactive" to "active". And a form completion might not be the last or current array. It could be completed at a later time.
<?php
function submit_form() {
$value = array(
'key' => '', // Array key?
'date' => date( get_option( 'date_format' ) . ' ' . get_option('time_format'), current_time( 'timestamp', 0 ) ),
'name' => $user_name,
'email' => $email,
'hash' => $hash,
'message' => esc_textarea( $_POST['commentText'] ),
@thefrosty
thefrosty / reset featured images
Last active December 11, 2015 07:49
Recently I accidentally set all posts featured image to the most recent uploaded image. Here is a snippet to fix it:
function extendd_exclude_extendd_settings_plugin( $query ) {
if ( 'plugin' == $query->query['post_type'] ) {
$current_user = wp_get_current_user();
// Not logged in = $current_user->ID == 0
if ( 0 == $current_user->ID ) /* && ( false === $query->query_vars['suppress_filters'] ) */ ) {
$protected_posts = get_extendd_settings_plugin(); //returns integer
@thefrosty
thefrosty / get my account pages
Last active December 10, 2015 16:08
The function works fine, but the $my_account and $my_account_pages are not merging. Getting an empty array in $my_account after merge. Not before though. Thoughts?
function get_extendd_my_account_pages() {
$all_wp_pages = wp_cache_get( 'extendd_my_account_pages' );
if ( false === $all_wp_pages ) {
// Set up the objects needed
$the_query = new WP_Query();
$all_wp_pages = $the_query->query( array( 'post_type' => 'page' ) );
wp_cache_set( 'extendd_my_account_pages', $all_wp_pages );
}
@thefrosty
thefrosty / httpd-vhosts.conf
Created February 6, 2015 17:55
Localhost Wildcard Subdomains
<VirtualHost *:80>
DocumentRoot "/Users/austinpassy/Documents/Websites/thefrosty.net/html"
ServerName thefrosty.dev
ServerAlias thefrosty.dev *.thefrosty.dev
<Directory "/Users/austinpassy/Documents/Websites/thefrosty.net/html">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
@thefrosty
thefrosty / activate edd download
Created December 1, 2012 23:22
Activation of plugin through EDD
function validate_license() {
//print '<pre>' . print_r( $_POST, true ) . '</pre>';
//print '<pre>' . print_r( $this->settings_sections, true ) . '</pre>';
//exit;
$data = array();
foreach ( $this->settings_sections as $section ) {