Skip to content

Instantly share code, notes, and snippets.

View A graphQL query for getting images related to products in BigCommerce
View Checks for local BigCommerce authentication token, and stores a new one if needs be
/*
* Get the auth token from local option
*
* @access public
* @return NULL
*/
public function get_local_auth_token() {
// get the token from the options table
$this->auth_token = get_option( 'bigcommerce_auth_token' );
@topher1kenobe
topher1kenobe / get_remote_auth_token.php
Last active Aug 31, 2020
Class method that gets an authenitcation token from BigCommerce
View get_remote_auth_token.php
/*
* Get the auth token from BigCommerce
*
* @access public
* @return string $token
*/
public function get_remote_auth_token() {
// Set up the REST authentication headers
$headers[ 'X-Auth-Token' ] = $this->access_token;
View gist:9e86b0b112739d0b397ede76e2284ea4
$meta_query = [
'meta_key' => 'pmp_required_levels',
'meta_value' => get_pmpro_subscription_ids( get_current_user_id() ),
'meta_compare' => 'IN',
'post_type' => 'li_resources',
];
// value holds an array like this
Array
(
@topher1kenobe
topher1kenobe / checkout_cart.php
Created Mar 14, 2015
Easy Digital Downloads adjusted checkout template file
View checkout_cart.php
<?php
/**
* This template is used to display the Checkout page when items are in the cart
*/
global $post; ?>
<table id="edd_checkout_cart" <?php if ( ! edd_is_ajax_disabled() ) { echo 'class="ajaxed"'; } ?>>
<thead>
<tr class="edd_cart_header_row">
<?php do_action( 'edd_checkout_table_header_first' ); ?>
@topher1kenobe
topher1kenobe / include-parent-css.php
Last active Aug 29, 2015
Include parent theme CSS properly
View include-parent-css.php
function t1k_get_parent_theme_css() {
wp_enqueue_style( 'make-theme', get_template_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 't1k_get_parent_theme_css' );
View gist:d2d8063afed13b1c1e06
### Keybase proof
I hereby claim:
* I am topher1kenobe on github.
* I am topher1kenobe (https://keybase.io/topher1kenobe) on keybase.
* I have a public key whose fingerprint is B667 2067 B47F D1B8 AC08 7340 8314 A0AF 19F8 B110
To claim this, I am signing this object:
View gist:895865806ad55820934d
function bg_video_scripts() {
wp_enqueue_script( 'bg-backgrounds', get_stylesheet_directory_uri() . '/assets/jquery.videoBG.js', array( 'jquery' ) );
wp_enqueue_script( 'bg-backgrounds-actuator', get_stylesheet_directory_uri() . '/assets/script.js', array( 'jquery' ) );
}
add_action( 'wp_enqueue_scripts', 'bg_video_scripts' );
@topher1kenobe
topher1kenobe / pacc_cross_post.php
Created Jun 30, 2014
Example of cross posting from a WordPress subsite to the parent site
View pacc_cross_post.php
<?php
/*
Plugin Name: PACC Cross Post
Plugin URI: http://thepacc.com
Description: Allows subsites to cross post to the main site
Author: Topher
Version: 1.0
Author URI: http://codeventure.net
*/
@topher1kenobe
topher1kenobe / gist:8511994
Created Jan 19, 2014
Make WordPress image insert function use html5 figures
View gist:8511994
/**
* Swap Default TinyMCE Tags for Figure Tags on Images
*/
function html5_insert_image( $html, $id, $caption, $title, $align ) {
$title = esc_attr( $title );
$caption = sanitize_text_field( $caption );
$id = absint( $id );
$url = esc_url( wp_get_attachment_url( $id ) );