Skip to content

Instantly share code, notes, and snippets.

View wpscholar's full-sized avatar
😀
Happy

Micah Wood wpscholar

😀
Happy
View GitHub Profile
@wpscholar
wpscholar / disable-rankmath-sitemap-caching.php
Created August 31, 2023 21:09
Disable RankMath Sitemap Caching
<?php
/**
* Plugin Name: Disable RankMath Sitemap Caching
*/
add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
@wpscholar
wpscholar / wp-enqueue-scripts.php
Created August 18, 2023 18:07
Example Enqueue
<?php
add_action(
'wp_enqueue_scripts',
function() {
...
}
);
@wpscholar
wpscholar / add-featured-image-to-rss-feed.php
Last active August 16, 2023 14:02
Add the featured image to RSS feed(s)
@wpscholar
wpscholar / woo-add-cart-fee.php
Last active May 10, 2023 01:14
WooCommerce: Add a 4% Credit Card Processing Fee to the Checkout Page
<?php
/**
* WooCommerce Add Fee to the Checkout Page
*
* @package WooCommerceAddFeeToCheckout
* @author Micah Wood
* @copyright Copyright 2023 by Micah Wood - All rights reserved.
* @license GPL2.0-or-later
*
* @wordpress-plugin
@wpscholar
wpscholar / university-customer-role-assignment.php
Last active January 28, 2023 04:20
A WordPress plugin that changes the user role to "University Customer" if a user registers with a .edu email address.
<?php
/**
* University Customer Role Assignment
*
* @package UniversityCustomerRoleAssignment
* @author Micah Wood
* @copyright Copyright 2023 by Micah Wood - All rights reserved.
* @license GPL2.0-or-later
*
@wpscholar
wpscholar / connect-tech-demo.cy
Created November 7, 2022 16:53
A Chrome recording converted into a Cypress test.
describe("Connect.tech Demo", () => {
it("tests Connect.tech Demo", () => {
cy.viewport(952, 976);
cy.visit("https://www.google.com/");
cy.get("body > div.L3eUgb > div.o3j99.ikrT4e.om7nvf > form > div:nth-child(1) > div.A8SBwf > div.RNNXgb > div > div.a4bIc > input").click();
cy.get("body > div.L3eUgb > div.o3j99.ikrT4e.om7nvf > form > div:nth-child(1) > div.A8SBwf > div.RNNXgb > div > div.a4bIc > input").type("seo");
@wpscholar
wpscholar / connect-tech-demo.json
Created November 7, 2022 16:51
A Chrome recording that can be downloaded and replayed in the browser.
{
"title": "Connect.tech Demo",
"steps": [
{
"type": "setViewport",
"width": 952,
"height": 976,
"deviceScaleFactor": 1,
"isMobile": false,
"hasTouch": false,
@wpscholar
wpscholar / simple-website-redirect-not-homepage.php
Last active October 31, 2022 17:13
An add-on plugin for the "Simple Website Redirect" plugin that prevents redirects from happening on the homepage.
<?php
/**
* Simple Website Redirect - Not Homepage
*
* @package SimpleWebsiteRedirectNotHomepage
* @author Micah Wood
* @copyright Copyright 2022 by Micah Wood - All rights reserved.
* @license GPL2.0-or-later
*
@wpscholar
wpscholar / cypress.yml
Created April 29, 2022 21:01
Sample GitHub Action workflow for running Cypress tests with @wordpress/env
name: Cypress Tests
on:
push:
branches:
- master
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review]
pull_request_review:
types: [submitted, edited]
@wpscholar
wpscholar / commands.js
Created April 29, 2022 20:25
Cypress commands for conditionally logging into WordPress. Add to cypress/support/commands.js
Cypress.Commands.add('login', () => {
// Fetch username and password from the cypress.env.json file.
const username = Cypress.env('wpUsername');
const password = Cypress.env('wpPassword');
cy
.getCookies()
.then(cookies => {
let hasMatch = false;