Skip to content

Instantly share code, notes, and snippets.

// change slug on post if title is changed.
add_action( 'save_post', 'icput_post_title_fix' );
function icput_post_title_fix( $post_id ) {
$url = rwmb_get_value( 'canonical_url', '', $post_id );
if ( empty( $url ) ) {
return;
}
@topher1kenobe
topher1kenobe / gist:73053b393cad123510e1bbbecf1b4457
Created October 11, 2022 20:20
take a screenshot, ssh it someplace
#!/bin/bash
/opt/homebrew/bin/ffmpeg -ss 0.5 -f avfoundation -r 30.000030 -i "0" -t 1 /Users/topher/window_shots/"grmi_$(date +%F_%H-%M-%S).jpg" -frames:v 1
unset -v latest
for file in /Users/topher/window_shots/*; do
[[ $file -nt $latest ]] && latest=$file
done
keychain --noask --eval id_dsa
@topher1kenobe
topher1kenobe / podcast_link_buttons.php
Created December 5, 2021 21:11
Podcast Buttons file for wppodcasts.com
/*
* 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 August 31, 2020 19:13
Class method that gets an authenitcation token from BigCommerce
/*
* 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;
$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 March 14, 2015 21:24
Easy Digital Downloads adjusted checkout template file
<?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 August 29, 2015 14:05
Include parent theme CSS properly
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' );
### 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: