Skip to content

Instantly share code, notes, and snippets.

View mommaroodles's full-sized avatar

Melanie Shepherd mommaroodles

  • Triton Web Solutions
  • South Africa
View GitHub Profile
@mommaroodles
mommaroodles / component.tsx
Last active April 28, 2025 15:56
PayloadCMS - Add Icon Select to Blocks
// src/blocks/CoreFeatures/component.tsx
import React from 'react'
import { RenderIcon, IconName } from '@/components/Icons'
interface CoreFeaturesBlockProps {
heading?: string
subheading?: string
features: {
icon: IconName
@mommaroodles
mommaroodles / bump-payload.ts
Created April 28, 2025 15:25 — forked from r1tsuu/bump-payload.ts
script to bump all Payload 3.0 related packages versions to latest.
/**
* Place this to ./src/scripts/bump-payload.ts
* Then in your package.json add script:
* "bump-payload": "tsx ./src/scripts/bump-payload.ts ./package.json && pnpm i"
* Run `pnpm bump-payload`
*/
import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';
@mommaroodles
mommaroodles / prd.md
Created April 12, 2025 10:08 — forked from burkeholland/prd.md
TheUrlist PRD

Project Requirements Document: The Urlist Website

The following table outlines the detailed functional requirements of The Urlist website.

Requirement ID Description User Story Expected Behavior/Outcome
FR001 Creating a New URL List As a user, I want to be able to start a new, empty list so I can begin adding URLs. The system should provide a clear way for the user to initiate the creation of a new list, potentially presenting an empty list view or an "add new list" button.
FR002 A
@mommaroodles
mommaroodles / batch-processing-log.txt
Created February 25, 2025 19:02
WooCommerce Settings - Liedjiesbos
2025-02-25T00:29:32+00:00 Error Error processing batch for Order synchronizer: Processor is enqueued but not scheduled. Background job was probably killed or marked as failed. Reattempting execution.
Additional context
2025-02-25T00:44:36+00:00 Error Error processing batch for Order synchronizer: Processor is enqueued but not scheduled. Background job was probably killed or marked as failed. Reattempting execution.
Additional context
2025-02-25T00:47:10+00:00 Error Error processing batch for Order synchronizer: Processor is enqueued but not scheduled. Background job was probably killed or marked as failed. Reattempting execution.
Additional context
2025-02-25T00:51:39+00:00 Error Error processing batch for Order synchronizer: Processor is enqueued but not scheduled. Background job was probably killed or marked as failed. Reattempting execution.
Additional context
2025-02-25T00:57:57+00:00 Error Error processing batch for Order synchronizer: Processor is enqueued but not scheduled. Background job was p
@mommaroodles
mommaroodles / functions.php
Created February 24, 2025 06:06
Custom Role Labels for WordPress
function custom_role_labels( $translated_text, $text, $domain ) {
if ( 'woocommerce' === $domain ) {
switch ( $text ) {
case 'Shop Manager':
$translated_text = 'Administrator';
break;
case 'Administrator':
$translated_text = 'Super Administrator';
break;
}
@mommaroodles
mommaroodles / funtions.php
Last active February 17, 2025 03:06
Custom Stock Status - Discontinued
<?php
// Step 1: Add custom stock status to WooCommerce product stock statuses
add_filter('woocommerce_product_stock_status_options', 'custom_woocommerce_product_stock_status_options');
function custom_woocommerce_product_stock_status_options($status_options) {
$status_options['discontinued'] = __('Discontinued', 'woocommerce');
return $status_options;
}
// Step 2: Save custom stock status for products
add_action('woocommerce_process_product_meta', 'custom_save_product_meta');
@mommaroodles
mommaroodles / functions.php
Created February 9, 2025 10:16
Register Custom Post Type Books
<?php
/**
* Register a custom post type called "Books".
*/
function custom_post_type_books() {
$labels = array(
'name' => _x( 'Books', 'post type general name', 'textdomain' ),
'singular_name' => _x( 'Book', 'post type singular name', 'textdomain' ),
'menu_name' => _x( 'Books', 'admin menu', 'textdomain' ),
'name_admin_bar' => _x( 'Book', 'add new on admin bar', 'textdomain' ),
@mommaroodles
mommaroodles / functions.php
Created February 9, 2025 10:10
Unregister a custom post type
/**
* Unregister a custom post type in WordPress.
*/
function remove_custom_post_type() {
// Check if the post type exists before attempting to unregister it
$post_type = 'your_custom_post_type'; // Replace with the slug of the custom post type you want to remove
if (post_type_exists($post_type)) {
unregister_post_type($post_type);
}
}
@mommaroodles
mommaroodles / functions.php
Created December 9, 2024 16:05
Disable do pings and clear records in db
if (isset($_GET['doing_wp_cron'])) {
remove_action('do_pings', 'do_all_pings');
wp_clear_scheduled_hook('do_pings');
}
@mommaroodles
mommaroodles / autoload-size-detailed.sql
Last active December 9, 2024 15:55
mySQL - Check autoload size in wp_options table - detailed
SELECT 'autoloaded data in KiB' as name, ROUND(SUM(LENGTH(option_value))/ 1024) as value FROM wp_options WHERE autoload='yes'
UNION
SELECT 'autoloaded data count', count(*) FROM wp_options WHERE autoload='yes'
UNION
(SELECT option_name, length(option_value) FROM wp_options WHERE autoload='yes' ORDER BY length(option_value) DESC LIMIT 10);