Skip to content

Instantly share code, notes, and snippets.

View adamplabarge's full-sized avatar

Adam LaBarge adamplabarge

View GitHub Profile
@adamplabarge
adamplabarge / unique_multi_arrays.php
Last active August 29, 2015 14:24
unique multi dimensionnel arrays
<?php
/**
* @param = multi-dimensionnal array with dups
* @return = unique multi-dimensional array
*/
function make_arrays_unique( $array )
{
array_map("unserialize", array_unique(array_map("serialize", $arras)));
}
@adamplabarge
adamplabarge / Ajax_Controller.php
Last active August 29, 2015 14:24
Ajax API for WP - setup for PSR4 autoload
<?php
namespace Classes;
/*//////////////////////////////////////////////////////////////////////////////
================================================================================
Ajax_Controller
- registers, enqueues, localizes ajax js file
- passes method and params to Ajax_Function_Suite();
- returns $ajax_function_suite->respond() as JSON
- don't forget nonce
@adamplabarge
adamplabarge / gf-acf-image-attachment-maker.php
Last active October 27, 2016 20:41
GF-ACF image attachment maker
<?php
//* the the default upload path to work in normal WP structure
add_filter("gform_upload_path", "change_upload_path", 20, 2);
function change_upload_path($path_info, $form_id){
$wp_upload_path = wp_upload_dir();
$path_info["path"] = $wp_upload_path['path'] . '/';
$path_info["url"] = $wp_upload_path['url'] . '/';
return $path_info;