Skip to content

Instantly share code, notes, and snippets.

View aolin480's full-sized avatar

Aaron Olin aolin480

View GitHub Profile

Keybase proof

I hereby claim:

  • I am aolin480 on github.
  • I am olie480 (https://keybase.io/olie480) on keybase.
  • I have a public key ASB_bcWPmZUGxCK6VinVcrPeLehjMRYmWK_WEc0Rjh_lrwo

To claim this, I am signing this object:

@aolin480
aolin480 / black.css
Last active August 13, 2018 18:57
Slack Dark Theme
/*
:: Add the following code to the bottom of /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
:: styles seem to only apply if stylesheet is hosted from github. Tried using a https domain but no dice
-----------------------------
document.addEventListener('DOMContentLoaded', function() {
$.ajax({
url: 'https://gist.githubusercontent.com/aolin480/759a15986416d7d019aa339c7ff70331/raw/9a41d3bc053f2fa7b9932dffaa85e4828d691cf5/black.css',
success: function(css) {
$("<style></style>").appendTo('head').html(css);
@aolin480
aolin480 / epoch-to-wordpress-post-date.php
Created June 27, 2018 16:12
Convert EPOCH timestamp to Wordpress post_date
<?php
$timestamp = '1517341140000';
$post_arr = [
'post_title' => 'Meh title',
'post_type' => 'post', //could be any custom post type
'post_content' => 'Meh body',
'post_category' => ['meh category'],
'post_status' => 'publish'
@aolin480
aolin480 / class-CustomEndpoint.php
Last active November 2, 2017 15:56
Custom Wordpress Query Page - Custom Permalinks
<?php
/**
* Custom Wordpress Query Page - Custom Permalinks
* @author Aaron Olin
*/
if (! class_exists('CustomEndpoint')) {
class CustomEndpoint {
protected static $_instance = null;
protected $templateFile;
@aolin480
aolin480 / wpml_translate_create_translate_post_programatically
Created July 21, 2017 15:26
Creates an English post, and attaches a Russian translation to English post programatically. Thanks janekS!
function multilingual_post_creation(){
global $sitepress;
/**
/**
Creating first post in english
*/
//arguments for post creation
$def_args = array(
@aolin480
aolin480 / my-wordpress-permalink-api-endpoint.php
Last active June 16, 2017 22:05
Custom Wordpress endpoint permalink to do whatever you like
@aolin480
aolin480 / example-wp-list-table.php
Created March 8, 2017 20:41 — forked from paulund/example-wp-list-table.php
An example code of using the WP_List_Table class. With Pagination.
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
@aolin480
aolin480 / wp_export_post_by_id
Last active April 1, 2016 04:12
Export Wordpress Post by ID - by setting a temporary author, assigning it to the post, then reverting temp author
<?php
/*
NOT TOTALLY FUNCTIONAL - NOT TOTALLY FUNCTIONAL - NOT TOTALLY FUNCTIONAL - YOU MAY HAVE TO WORK IT INTO YOUR PROJECT DIFFERENTLY
*/
add_action('admin_init', function(){
if( isset( $_GET['di_export'] ) ) :
// post id = 177 // Collision Center
@aolin480
aolin480 / woocommerce-custom-cart-item-data.php
Created October 29, 2015 02:37 — forked from RadGH/woocommerce-custom-cart-item-data.php
Get and set custom cart item/product information prior to WooCommerce checkout, and carry those valus over to Order Item Metadata.
<?php
/*
Instructions:
1) Save data when adding to cart
When adding an item to your cart, use ld_woo_set_item_data. The best action for this to occur is
"woocommerce_add_to_cart". The first parameter for this action contains the "cart_item_key",
which is required for the function.
@aolin480
aolin480 / owl-carousel-group-items-into-divs.php
Last active October 5, 2015 21:08
This can be used in anything, but I recently had the pleasure of working with Owl Carousel and a client needed to group 3 images in a owl carousel slide, this PROPERLY groups elements into a div without creating an orphan div group towards the end.