This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Optimization Detective Default Disabled | |
* Plugin URI: https://gist.github.com/westonruter/9e9036e8dc11292279a90995273c7adc | |
* Description: Disables Optimization Detective by default unless you supply the <code>?optimization_detective_enabled=1</code> query parameter. This allows you to debug issues on a live site without visitors seeing a broken experience. | |
* Requires at least: 6.5 | |
* Requires PHP: 7.2 | |
* Requires Plugins: optimization-detective | |
* Version: 0.1.0 | |
* Author: Weston Ruter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Speculative Loading: Eagerly Prerender Homepage from Singular Template | |
* Plugin URI: https://gist.github.com/westonruter/eb51e56c7e92f3cd6e3088eb87d9ce07 | |
* Description: When viewing a singular post or page, eagerly prerender the homepage so that navigating there will be instant. | |
* Requires at least: 5.7 | |
* Requires PHP: 7.2 | |
* Version: 0.1.0 | |
* Author: Weston Ruter | |
* Author URI: https://weston.ruter.net/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Speculative Loading: Eagerly Prerender First Post in Archive Loop | |
* Plugin URI: https://gist.github.com/westonruter/78c0640fb108e2e94e7b0a536e9a9140 | |
* Description: For templates that list out one or more posts (i.e. blog index, archives, search results), eagerly prerender the first post in The Loop since it is the most likely link the user will visit. | |
* Requires at least: 5.7 | |
* Requires PHP: 7.2 | |
* Version: 0.1.0 | |
* Author: Weston Ruter | |
* Author URI: https://weston.ruter.net/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Twenty Twenty-Five Stylesheet Inlining | |
* Plugin URI: https://gist.github.com/westonruter/09e553a7b66d1a2e68cd5a9ed351c59b | |
* Description: Minifies and adds <code>path</code> style data for the <code>twentytwenty-five-style</code> stylesheet so it can be inlined. See <a href="https://core.trac.wordpress.org/ticket/63007">#63007</a>. | |
* Requires at least: 6.5 | |
* Requires PHP: 7.2 | |
* Version: 0.1.0 | |
* Author: Weston Ruter | |
* Author URI: https://weston.ruter.net/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Always Print Script Modules in Head | |
* Plugin URI: https://gist.github.com/westonruter/f9e67442c674c3176b95cd1ed0e784c1 | |
* Description: In classic themes script modules are forced to print in the footer since the HEAD is rendered before the rest of the page, so it is not yet known what script modules will be enqueued. This can be fixed with output buffering. This is a demonstration plugin for Core Trac ticket #43258 which adds output buffering for the rendered template. | |
* Requires at least: 6.8-beta1 | |
* Version: 0.1.0 | |
* Author: Weston Ruter | |
* Author URI: https://weston.ruter.net/ | |
* License: GPLv2 or later |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Always Load Block Styles on Demand | |
* Plugin URI: https://gist.github.com/westonruter/99af37489334927aaf04a46eaf2a11eb | |
* Description: In classic themes a lot more CSS is added to a page than is needed because when the HEAD is rendered before the rest of the page, so it is not yet known what blocks will be used. This can be fixed with output buffering. This is a demonstration plugin for Core Trac ticket #43258 which adds output buffering for the rendered template. | |
* Requires at least: 6.8-beta1 | |
* Version: 0.1.0 | |
* Author: Weston Ruter | |
* Author URI: https://weston.ruter.net/ | |
* License: GPLv2 or later |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Constructs a CSS selector for the current tag. | |
* | |
* @param WP_HTML_Processor $processor Processor. | |
* @return string Selector. | |
*/ | |
function get_css_selector( WP_HTML_Processor $processor ): string { | |
$selector = join( ' > ', $processor->get_breadcrumbs() ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TEMPORARY FUNCTION IS_CMS(technologies ARRAY<STRUCT<technology STRING, categories ARRAY<STRING>, info ARRAY<STRING>>>, cms STRING, version STRING) RETURNS BOOL AS ( | |
EXISTS( | |
SELECT * FROM UNNEST(technologies) AS technology, UNNEST(technology.info) AS info | |
WHERE technology.technology = cms | |
AND ( | |
version = "" | |
OR ENDS_WITH(version, ".x") AND (STARTS_WITH(info, RTRIM(version, "x")) OR info = RTRIM(version, ".x")) | |
OR info = version | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Finalizes extension. | |
* | |
* @type {FinalizeCallback} | |
* @param {FinalizeArgs} args Args. | |
*/ | |
export async function finalize( { extendRootData } ) { | |
const script = document.getElementById( 'od-normalized-query-vars' ); | |
if ( script instanceof HTMLScriptElement ) { | |
extendRootData( { queryVars: JSON.parse( script.text ) } ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Finalizes extension. | |
* | |
* @type {FinalizeCallback} | |
* @param {FinalizeArgs} args Args. | |
*/ | |
export async function finalize( { extendRootData } ) { | |
extendRootData( { userAgent: navigator.userAgent } ); | |
} |
NewerOlder