Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Timothy Wood codearachnid

🎯
Focusing
View GitHub Profile
@codearachnid
codearachnid / WooCommerce-Edit-General-SKU.php
Created Nov 19, 2020
Needed a quick drop in script for functions.php to add SKU field on the general tab within WooCommerce product editor
View WooCommerce-Edit-General-SKU.php
<?php
// add sku on woocommerce product editor >> general tab
add_action( 'woocommerce_product_options_general_product_data', 'add_the_sku_to_general_product_field' );
function add_the_sku_to_general_product_field() {
global $post;
$product_sku = get_post_meta( $post->ID, '_sku', true );
?>
<div class="options_group">
<p class="form-field _sku_field ">
@codearachnid
codearachnid / report.SQL
Created Feb 6, 2020
Sabai Report Directory Export Report (Camp Finder)
View report.SQL
SELECT t1.entity_id, t2.post_id, t2.post_title, t1.value, t3.address, t3.street, t3.city, t3.state, t3.zip, t4.phone, t4.mobile, t4.fax, t4.email, t4.website, DATE_FORMAT(FROM_UNIXTIME(t5.edited_at), "%Y-%m-%d")
FROM wp_sabai_entity_field_content_body as t1
LEFT JOIN wp_sabai_content_post as t2
ON t1.entity_id = t2.post_id
LEFT JOIN wp_sabai_entity_field_directory_location as t3
ON t1.entity_id = t3.entity_id
LEFT JOIN wp_sabai_entity_field_directory_contact as t4
ON t1.entity_id = t4.entity_id
LEFT JOIN wp_sabai_entity_field_content_activity as t5
ON t1.entity_id = t5.entity_id
@codearachnid
codearachnid / sabai-directory-dashboard-shortcode.php
Created Feb 2, 2019
If you have Sabai and you want to customize the dashboard to be part of another page (like inside of woocommerce my account) use this shortcode
View sabai-directory-dashboard-shortcode.php
<?php
add_shortcode('sabai-directory-dashboard', 'sabai_directory_dashboard_get_shortcode');
function sabai_directory_dashboard_get_shortcode($atts, $content, $tag){
$platform = get_sabai_platform();
$path = $platform->getSabai()->getAddon('Directory')->getSlug('dashboard');
return $platform->shortcode($path, (array)$atts, $content);
}
View Easel Backup Settings
$0=10
$1=255
$2=0
$3=3
$4=0
$5=0
$6=0
$10=115
$11=0.020
$12=0.002
View Sabai Export.sql
SELECT t1.entity_id, t2.post_id, t2.post_title, t1.value, t3.address, t3.street, t3.city, t3.state, t3.zip, t4.phone, t4.mobile, t4.fax, t4.email, t4.website
FROM wp_sabai_entity_field_content_body as t1
LEFT JOIN wp_sabai_content_post as t2
ON t1.entity_id = t2.post_id
LEFT JOIN wp_sabai_entity_field_directory_location as t3
ON t1.entity_id = t3.entity_id
LEFT JOIN wp_sabai_entity_field_directory_contact as t4
ON t1.entity_id = t4.entity_id
WHERE t2.post_entity_bundle_name = 'campfinder_listing'
AND t2.post_status = 'published'
@codearachnid
codearachnid / ajax-actions.php
Created Nov 8, 2018
Fix date format for export convertplus
View ajax-actions.php
<?php
// convertplus/admin/ajax-actions.php
// line 3133
/*** RFM DATE ADJUST ***/
foreach($contacts as $key => $contact){
$contact['date'] = date("Y-m-d", strtotime($contact['date']));
$contacts[$key] = $contact;
}
@codearachnid
codearachnid / Main.php
Last active Nov 21, 2015
Modern Tribe's The Event Calendar plugin edit event screen improvement.
View Main.php
<?php
/**
* Modern Tribe's The Event Calendar plugin would be much faster in the editing interface
* if it removed the upfront loading of organizers and venues from the select dropdown and
* relied on AJAX loading after initial page load. Additional improvement would be to drop
* the `get_the_title` method when displaying the venue and organizer titles in the list.
* This was tested on a production site with ~4500+ events. Average of 10 attempts time to
* load edit screen prior to modification 47.2 seconds with memory load 290.63mb and
* 18,968 queries. In contrast after modification 16.88 seconds with memory load 217.89mb
* and 155 queries.
View ..\events-calendar-pro\src\Tribe\APM_Filters\Date_Filter.php
<?php
// look at line 69 and change
$field = 'eventStart.meta_value';
// to
$field = 'tribe_event_start_date.meta_value';
/**********/
@codearachnid
codearachnid / filter_gf_select_optgroup.php
Last active Dec 23, 2020
Add the optgroup ability to Gravity Forms default select field.
View filter_gf_select_optgroup.php
/**
* Filter Gravity Forms select field display to wrap optgroups where defined
* USE:
* set the value of the select option to `optgroup` within the form editor. The
* filter will then automagically wrap the options following until the start of
* the next option group
*/
add_filter( 'gform_field_content', 'filter_gf_select_optgroup', 10, 2 );
function filter_gf_select_optgroup( $input, $field ) {
@codearachnid
codearachnid / app.js
Created Jul 1, 2015
Angular JS demo app
View app.js
angular.module('SampleApp', ['ngRoute'])
.filter('filterByProperty', function(){
return function( items, propMatch ){
var filtered = [];
for (var i = 0; i < items.length; i++) {
var item = items[i];
for(var property in propMatch){
if (propMatch[property] == item[property]) {
You can’t perform that action at this time.