Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
woodwardtw / more-json-info.php
Created November 8, 2022 13:41
add useful usage data to the base JSON of the WordPress site
View more-json-info.php
/*---------------------------------JSON MOD FOR ADDITIONAL SITE INFO----------------------------------*/
function extraJsonData($response){
$blog_id = get_current_blog_id();
$blog_details = get_blog_details($blog_id);
$data = $response->data;
$data['created'] =$blog_details->registered;
$data['last_updated'] =$blog_details->last_updated;
$data['post_count'] =$blog_details->post_count;
$data['page_count'] = wp_count_posts('page','publish');
@woodwardtw
woodwardtw / wp-config.php
Created October 13, 2022 12:48
wp config shush and show
View wp-config.php
/**
* these are two alternative settings for wp-config.php don't use both!
**/
/**
* super shush any errors or warnings
**/
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
@woodwardtw
woodwardtw / catalog.css
Last active January 27, 2023 13:08
Middlebury Canvas Catalog Custom CSS
View catalog.css
h1,
h2,
h3,
h4,
h5,
.h1 {
font-family: Domine, georgia, serif;
}
#app-header {
@woodwardtw
woodwardtw / config.json
Last active December 8, 2022 16:13
IIIF manifest in themes > theme name > asset > universal viewer
View config.json
{
"options": {
"bookmarkThumbHeight": 150,
"bookmarkThumbWidth": 90,
"leftPanelEnabled": true,
"limitLocales": true,
"minWidthBreakPoint": 610,
"navigatorEnabled": true,
"openTemplate": "http://universalviewer.io?manifest={0}",
"overrideFullScreen": false,
@woodwardtw
woodwardtw / example-pything-dooo.py
Created August 19, 2022 14:38
just a poc showing how the php stuff might get written around the csv data
View example-pything-dooo.py
# full path
data = open("../../test/test.php", "w")
phpheader = ["<?php \n", "defined( 'ABSPATH' ) || exit; \n", "$bar = '"]
data.writelines(phpheader)
# regular csv stuff to populate the variable
View victor-chen-custom.css
section.chapter header h1,
.front-matter h5,
.part h5,
.chapter h5,
.back-matter h5,
body#tinymce.wp-editor h5,
.front-matter h2,
.part h2,
.chapter h2,
.back-matter h2,
@woodwardtw
woodwardtw / escape-the-panopticon.js
Created July 1, 2022 18:36
bookmarklet to download Panopto videos in playlist
View escape-the-panopticon.js
javascript: (() => {var tableRows = document.querySelector('.session-list').querySelectorAll('tr');tableRows.forEach((row) => {if(row.dataset){var dlUrl = 'https://midd.hosted.panopto.com/Panopto/Podcast/Download/'+row.dataset.id+'.mp4?mediaTargetType=videoPodcast';window.open(dlUrl);}});})();
View bava-library-options.php
<?php
//simple GF merge field modifier that replaces the space with a dash
add_filter( 'gform_merge_tag_filter', function ( $value, $merge_tag, $modifier, $field, $raw_value, $format ) {
if ( $merge_tag != 'all_fields' && $modifier == 'urlmaker' ) {
$value = str_replace(" ", "-", $value);
}
return $value;
}, 10, 6 );
@woodwardtw
woodwardtw / gf_to_events_calendar.php
Last active June 30, 2022 19:22
makes a live event that does require manual update
View gf_to_events_calendar.php
<?php
add_action( 'gform_after_submission_3', function ( $entry ) {
if ( ! function_exists( 'tribe_create_event' ) ) {
return;
}
$start_date = rgar( $entry, '2' );
$start_time = rgar( $entry, '3' );
$end_date = rgar( $entry, '4' );
$end_time = rgar( $entry, '5' );
@woodwardtw
woodwardtw / sensus.php
Created June 17, 2022 12:15
index builder for sensus access data
View sensus.php
<h1>SensusAccess Stats Index</h1>
<?php
function create_file_name($string){
$name = str_replace('middlebury-report-','', $string);
$name = substr($name,0,10);
return $name;
}
$files = scandir('.');