Skip to content

Instantly share code, notes, and snippets.

View jackgregory's full-sized avatar

Jack Gregory jackgregory

View GitHub Profile
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@Abban
Abban / WordPress Theme Customizer Sample.php
Created June 21, 2012 21:09
WordPress Theme Customizer Sample
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
@PhilKershaw
PhilKershaw / gist:f8e995e6b7d749e30740
Last active November 2, 2020 05:45
Simple script to export a CSV from Magento for consumption by eKomi
<?php
require_once ("app/Mage.php");
class TradeOrders
{
private static $headers = array('ORDER_ID', 'EMAIL', 'LAST_NAME', 'FIRST_NAME', 'PRODUCT_ID', 'PRODUCT_NAME');
public static function get($from, $to) {
// Fetch all UK Trade orders within specified date range
@claudiosanches
claudiosanches / functions.php
Created September 12, 2014 13:49
WooCommerce 2.2 - Register new order statuses.
<?php
// My new order statuses.
function register_my_new_order_statuses() {
register_post_status( 'wc-status-name', array(
'label' => _x( 'Status Name', 'Order status', 'textdomain' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
@BFTrick
BFTrick / woocommerce-demo-plugin.php
Created October 20, 2014 22:11
A demo WooCommerce plugin
<?php
/**
* Plugin Name: WooCommerce Demo Plugin
* Plugin URI: https://gist.github.com/BFTrick/3ab411e7cec43eff9769
* Description: A WooCommerce demo plugin
* Author: Patrick Rauland
* Author URI: http://speakinginbytes.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
@chrisjhoughton
chrisjhoughton / enforce-http.liquid.js
Last active February 14, 2024 07:49
How to build an ajax form on Shopify. See http://inside.sauce.ly/how-to-build-an-ajax-login-form-on-shopify/ for the full blog post.
/*
* Ensure the http protocol is always used on the myshopify.com domains.
* Uses liquid to input the correct URL.
*/
if (window.location.href.match(/https:\/\/.*.myshopify.com/) && top === self) {
window.location.href = window.location.href.replace(/https:\/\/.*.myshopify.com/, 'http://{{ shop.domain }}');
}
<?php
/**
* @see http://stackoverflow.com/questions/40836144/php-how-to-get-images-from-instagram-without-api-access-token
* You can use function file_get_conents instead wp_remote_get
*/
function get_instagram_images( $username, $limit = 100 ){
$profile_url = "https://www.instagram.com/$username/?__a=1";
$iteration_url = $profile_url;