Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Olin aolin480

View GitHub Profile
View keybase.md

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 Aug 13, 2018
Slack Dark Theme
View black.css
/*
:: 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 Jun 27, 2018
Convert EPOCH timestamp to Wordpress post_date
View epoch-to-wordpress-post-date.php
<?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 Nov 2, 2017
Custom Wordpress Query Page - Custom Permalinks
View class-CustomEndpoint.php
<?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 Jul 21, 2017
Creates an English post, and attaches a Russian translation to English post programatically. Thanks janekS!
View wpml_translate_create_translate_post_programatically
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 Jun 16, 2017
Custom Wordpress endpoint permalink to do whatever you like
View my-wordpress-permalink-api-endpoint.php
@aolin480
aolin480 / example-wp-list-table.php
Created Mar 8, 2017 — forked from paulund/example-wp-list-table.php
An example code of using the WP_List_Table class. With Pagination.
View example-wp-list-table.php
<?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 Apr 1, 2016
Export Wordpress Post by ID - by setting a temporary author, assigning it to the post, then reverting temp author
View wp_export_post_by_id
<?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 Oct 29, 2015 — 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.
View woocommerce-custom-cart-item-data.php
<?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 Oct 5, 2015
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.
View owl-carousel-group-items-into-divs.php