Skip to content

Instantly share code, notes, and snippets.

View topher1kenobe's full-sized avatar

Topher DeRosia topher1kenobe

View GitHub Profile
@topher1kenobe
topher1kenobe / class-ie-slider.php
Created December 10, 2024 19:27
Full plugin for slider
<?php
/**
* Instantiate the IE_Slider instance
*
* @since IE_Slider 1.0
*/
class IE_Slider {
/**
* Term ID.
<?php
add_filter( 'rwmb_meta_boxes', 'ie_slideshow_shortcode' );
function ie_slideshow_shortcode( $meta_boxes ) {
$prefix = 'ie-slider-';
$meta_boxes[] = [
'title' => __( 'IE Slideshow', 'ie-slider' ),
'id' => 'ie-slideshow',
'closed' => true,
@topher1kenobe
topher1kenobe / gist:4ede89488143bbd78168f15c8528e2ac
Created December 8, 2024 20:17
Using MetaBox.io to create subsgroups.
<?php
$groups = rwmb_meta( 'ie-slider-sliders' );
foreach ( $groups as $group ) {
// Field slider:
$subgroups = $group[ 'slider' ] ?? '';
foreach ( $subgroups as $subgroup ) {
// Field title:
echo $subgroup[ 'title' ] ?? '';
@topher1kenobe
topher1kenobe / aql.php
Created July 31, 2024 21:57
Adjusting the Advanced Query Loop from Kadence via code.
add_filter( 'kadence_blocks_pro_query_loop_query_vars', 'hba_home_events_loop', 10, 3 );
function hba_home_events_loop( $query, $ql_query_meta, $ql_id ) {
if( 265 === $ql_id ) {
$meta_query = array(
array(
'key' => 'hba_event_beginning', // your event meta here
'value' => date('Y-m-d H:m'),
'type' => 'DATETIME',
'compare' => '>=' // only show dates matching the current date or in the future
// 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;