Skip to content

Instantly share code, notes, and snippets.

View hellofromtonya's full-sized avatar

Tonya Mork hellofromtonya

View GitHub Profile
@hellofromtonya
hellofromtonya / README.md
Last active February 15, 2023 19:18
Web Fonts Tester plugin: uses Jetpack's Google Fonts composer package.

Web Fonts API tester plugin using Jetpack's Google Fonts composer package

This is a tester plugin for the Web Fonts API. It uses the Jetpack Google Fonts Provider composer package.

This package uses the original webfonts array structure, which is now deprecated.

How to install

  1. In your local dev environment, create a new folder in wp-content/plugins/ called webfonts.
  2. In a command line tool (such as Terminal), type: composer install.
@hellofromtonya
hellofromtonya / changes.md
Created December 13, 2022 13:41
Web Fonts API architectural changes

Web Fonts API architectural changes

Web fonts array passed to wp_register_webfonts() changed:

Original API: each variation identifies its font-family.

wp_register_webfonts(
     array(
         array(
             'provider'    => 'local',
@hellofromtonya
hellofromtonya / mu-test.php
Created October 31, 2022 20:57
Must-use test file for Trac 56933.
<?php
add_action( 'loop_start', 'test_56933', 12 );
// For testing https://core.trac.wordpress.org/ticket/56933.
function test_56933() {
global $wpdb;
$search_string = 'hello';
$sql = $wpdb->prepare("(select $wpdb->posts.ID, post_title, {$wpdb->prefix}mgmlp_folders.folder_id, pm.meta_value as attached_file, 'a' as item_type
@hellofromtonya
hellofromtonya / testcpt.php
Created January 25, 2022 13:58
Basic CPT plugin
<?php
/**
* Test CPT with TT2.
*
* Plugin Name: Test CPT
* Plugin URI: https://github.com/tester/testcpt/
* Description: Tests custom post type blank screen with TT2
* Version: 1.0
* Author: tester
* Author URI: https://github.com/tester/testcpt/
@hellofromtonya
hellofromtonya / TEST_REPORT.md
Created November 5, 2021 21:46
Test Report experimentation with validating webfonts schema

Test Report

All tests are done the Validator commented out, i.e. no validation.

Testing Environment: *

  • Browser: Chrome
  • Theme: Twenty-Twenty Two (modified to use the Webfonts API)
  • Webfonts: Local and Google Fonts
@hellofromtonya
hellofromtonya / bio.md
Created October 11, 2021 14:56
Tonya's speaker bio

Tonya Mork is an engineering leader, engineer², strategist, and coach. Her story began in the mid-1980s with building high-tech automated manufacturing systems. Then life threw her a curve ball. She shifted her focus to helping developers and organizations excel. These days you'll find her focused on empowering people and tech to make the web better. Tonya is based in the US and is a full-time sponsored WordPress Core committer and open source contributor.

@hellofromtonya
hellofromtonya / test-trac53770.php
Last active July 28, 2021 18:33
Test script for rendering a table for the 'site_logo' & theme mod 'custom_logo' options
<?php
// Add this test script to wp-content/mu-plugins/test-trac53770.php
// Add the function into the theme where the site logo is rendered.
function test_trac53770_logo() {
$theme = get_option( 'stylesheet' );
$mods = get_theme_mods();
$options = array(
'get theme mods' => array(
@hellofromtonya
hellofromtonya / t53165.php
Created July 19, 2021 14:58
Trac ticket 53165 - Test Custom Taxonomy added as a must-use plugin
<?php
// Location of this code: wp-content/mu-plugins/t53165.php.
namespace Test\t53165;
add_action( 'init', __NAMESPACE__ . '\register_test_taxonomy' );
function register_test_taxonomy() {
$labels = array(
'name' => 'Tests',
'singular_name' => 'Test',
@hellofromtonya
hellofromtonya / 28020.php
Created April 29, 2021 17:16
Testing script for WordPress Trac ticket 28020
<?php
namespace Test\trac28020;
/**
* Add this file into the wp-content/mu-plugins folder.
*/
add_action( 'init', function() {
// Bail out if in the backend (Admin area). Only want to run this in the frontend.
if ( is_admin() ) {
@hellofromtonya
hellofromtonya / 51423.php
Created March 23, 2021 17:32
Core Ticket 51423: test script to make `wp_json_encode` fail during generation of personal data export JSON file.
<?php
namespace Testing\Ticket51423;
add_action( 'wp_privacy_personal_data_export_file', __NAMESPACE__ . '\setup_testing_export_file', 5 );
function setup_testing_export_file( $request_id ) {
$GLOBALS['testing_51423'] = array(
'request_id' => $request_id,
'_export_data_grouped' => get_post_meta( $request_id, '_export_data_grouped', true ),
);