- web.dev https://web.dev/measure/
- websu.io (*) (monitor) https://websu.io/
- webpagetest.org https://www.webpagetest.org/
- Pingdom Website Speed Test https://tools.pingdom.com/
- gtmetrix https://gtmetrix.com/
- foo.software https://www.foo.software/lighthouse
This file contains hidden or 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
# WordPress COMMON SETTINGS - WordOps 3.13.2 | |
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE | |
# Limit access to avoid brute force attack | |
#Yoast SEO Sitemaps | |
location ~ ([^/]*)sitemap(.*).x(m|s)l$ { | |
## this rewrites sitemap.xml to /sitemap_index.xml | |
rewrite ^/sitemap.xml$ /sitemap_index.xml permanent; | |
## this makes the XML sitemaps work | |
rewrite ^/([a-z]+)?-?sitemap.xsl$ /index.php?yoast-sitemap-xsl=$1 last; |
This file contains hidden or 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
function copyExcerptInMetaDesc(){ | |
$posts = get_posts(array( | |
'numberposts' => -1, | |
'fields' => 'ids', | |
'post_type' => array('post') | |
)); | |
foreach( $posts as $postId ){ | |
if(!get_post_meta( $postId, '_yoast_wpseo_metadesc', false )){ | |
$excerpt = get_the_excerpt($postId); |
This file contains hidden or 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: WordPress SQL Performance | |
* Plugin URI: https://www.pantheon.io | |
* Description: Fix SQL_CALC_FOUND_ROWS performance degradation. | |
* Author: Kyle Taylor, Pantheon | |
* Version: 1.0 | |
* License: GPL2 | |
* Credit: https://wpartisan.me/tutorials/wordpress-database-queries-speed-sql_calc_found_rows |
This file contains hidden or 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 | |
/** | |
* WooCommerce Template | |
* | |
* Functions for the templating system. | |
* | |
* @package WooCommerce\Functions | |
* @version 2.5.0 | |
*/ |
Find attributes by name.
function my_find_attribute_by_name( $name, $attribute ) {
global $wpdb;
$term_table = $wpdb->prefix . 'terms';
$taxonomy_table = $wpdb->prefix . 'term_taxonomy';
if ( ! empty( $name ) ) {
This file contains hidden or 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
$fontPath: '../../fonts'; | |
@mixin fonts($name, $file, $fontWeight) { | |
@font-face { | |
font-family: $name; | |
src: url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.eot'); | |
src: url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.eot?#iefix') format('embedded-opentype'), | |
url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.woff2') format('woff2'), | |
url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.woff') format('woff'), | |
url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.ttf') format('truetype'), |
This shows how to save a custom log of imported items. It can be adjusted to include any product data.
/***********************************************/
/***** BEGIN LOG CREATE / UPDATE / DELETE *****/
/********************************************* */
// This creates a custom log file in the root WordPress uploads folder
// Some of this code will need to be adjusted, please read comments.
This file contains hidden or 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 // wp-content/mu-plugins/ga4.php - GA4 tracker boilerplate. | |
define('GA_NOT_LIVE', true); // remove for go | |
define('GA4_MEASUREMENT_ID', 'G-XXXXXXXXXX'); // required | |
define('UA_PROPERTY_ID', 'UA-XXXXXXX-YY'); // optional | |
define('GA_ANONYMIZE_IP', true); // optional | |
define('GA_TRACK_ADMINS', false); // optional, defaults to true | |
define('GA_TRACK_EDITORS', false); // optional, defaults to true | |
// we need GA as first thing in the body |
This file contains hidden or 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
const axios = require('axios') | |
// This is the interface/object for communicating with GA4MP | |
export function GA4MPClient(apiSecret, measurementId, clientId) { | |
// Vars for GA4 connection | |
this.API_SECRET = apiSecret; // GA > Admin > Data Streams > choose your stream > Measurement Protocol > Create | |
this.MEASUREMENT_ID = measurementId; // GA Admin > Data Streams > choose your stream > Measurement ID |