Skip to content

Instantly share code, notes, and snippets.

View danmaby's full-sized avatar

Dan Maby danmaby

View GitHub Profile
@danmaby
danmaby / blueprint.json
Last active December 13, 2024 14:08
#WPLDN Speed Build Blueprint
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"meta": {
"title": "#WPLDN Speed Build.",
"description": "Dan Maby's #WPLDN Speed Build site.",
"author": "danmaby",
"categories": ["theme"]
},
"landingPage": "/",
"features": {
@danmaby
danmaby / 2024-12-13.xml
Last active December 13, 2024 14:07
#WPLDN Speed Build Blueprint - XML Export
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
@danmaby
danmaby / blueprint.json
Last active October 30, 2024 15:54
Test WordPress Playground Blueprint
{
"login": true,
"landingPage": "/wp-admin/",
"preferredVersions": {
"php": "8.3",
"wp": "beta"
},
"features": {
"networking": true
},
@danmaby
danmaby / description.md
Created October 17, 2024 07:40
Next.js 14 + tRPC + Appwrite: Session cookie not being set or persisted

I'm building a Next.js 14 application with tRPC and Appwrite for authentication. The T3 Stack was used as a starting point for this app. I'm encountering an issue where the session cookie is not being set or persisted after a successful login.

Environment:

  • Next.js 14 (App Router)
  • tRPC
  • Appwrite for authentication
  • Running on localhost with custom subdomain (my.example.localhost:3000)

Steps to reproduce:

@danmaby
danmaby / functions.php
Created September 28, 2023 10:38
Simple log in / log out shortcode for WordPress. Conditionally display a login or logout text link based on users logged in status.
<?php
/**
* Shortcode to display "Log in" or "Log out" link.
*
* @return string HTML string for the login/logout link.
*/
function dm_login_logout_shortcode() {
// Initialize an empty string to hold the output HTML.
$output = '';
@danmaby
danmaby / export_woo_subscriptions_to_csv.php
Last active September 13, 2023 09:37
Export WooCommerce Subscriptions to CSV. Provides a `Export Subscriptions` button in Woo admin menu
<?php
/**
* Plugin Name: Export WooCommerce subscriptions
* Plugin URI: https://www.blue37.com/
* Description: Export WooCommerce subscriptions to a CSV file.
* Version: 0.0.1
* Requires at least: 6.0
* Requires PHP: 8.0
* Author: Blue 37
@danmaby
danmaby / functions.php
Created July 24, 2023 08:52
A shortcode that displays the SEO description generated by the Filter Everything Pro plugin
/**
* Adds a shortcode that displays the SEO description generated by the Filter Everything Pro
* plugin. If no description is available, the shortcode will display the default content. An
* an optional 'default' attribute can be used to specify the default content.
*
* @param array $atts An array of shortcode attributes.
* @return string The shortcode output.
*/
function ps_add_filters_seo_description_shortcode($atts)
{
@danmaby
danmaby / functions.php
Created November 7, 2022 08:10
Set default button styles for GenerateBlocks
<?php
/*
* set GenerateBlocks button defaults
*
* @url https://github.com/tomusborne/generateblocks/blob/c2aad72f6868001c6f7fa9b606cafef511eebd1b/includes/defaults.php#L231-L243
*/
add_filter("generateblocks_defaults", function ($defaults) {
$color_settings = wp_parse_args(
get_option("generate_settings", []),
generate_get_color_defaults()
@danmaby
danmaby / readme.md
Created April 1, 2022 12:02
Install SSL with Node.js, Express and Socket.io

Getting started

A basic installation of Node.js, Express, and Socket.io served over https:// using a Letsencrypt SSL certificate.

Step 1 - Build DO Droplet (or server of your choice)

  • Spin up DO droplet
  • Set up DNS
  • Access the server via SSH
@danmaby
danmaby / attendee-login-open.php
Last active March 23, 2022 09:39
Apply Conditional Blocks PHP Logic using WordPress Pods custom settings options
<?php
/**
* Function to determine if login blocks should show.
*
* @return boolean true/false to show the block or not.
*/
function dv_atttendee_login_open( $option_name, $defaults = array() ) {
$options = get_option('dv_event_settings_dv_settings_allow_attendee_login');
//checking if setting is empty