Skip to content

Instantly share code, notes, and snippets.

View mizner's full-sized avatar

Michael Mizner mizner

View GitHub Profile
@mizner
mizner / ruleset.xml
Created February 19, 2023 23:40
wp phpcs ruleset example
<?xml version="1.0"?>
<ruleset name="My Custom Ruleset">
<description>Custom ruleset for my PHP project</description>
<!-- exclude vendor -->
<exclude-pattern>vendor</exclude-pattern>
<!-- exclude WordPress core -->
<exclude-pattern>*/wp-includes/*</exclude-pattern>
<exclude-pattern>*/wp-admin/*</exclude-pattern>
@mizner
mizner / updates-controller.php
Created December 21, 2022 05:58
WordPress Disable Core and Plugin Updates
<?php
/**
* Plugin Name: Updates Controller
* Description: Security upgrades and custom settings
* Version: 1.0.0
* License: GPL3+
*/
namespace MustUse\CustomSettings;
@mizner
mizner / .circleciconfig.yml
Created October 5, 2022 17:03
Example of Circle CI deployment to WP Engine
version: 2.1
# Environment Variables: https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands
orbs:
slack: circleci/slack@3.3.0
commands:
setup:
description: "Setup our build"
@mizner
mizner / github-deploy.yml
Last active October 5, 2022 17:05
Example of Github Action WP Engine Deployment
name: Deploy!
on:
push:
branches:
- production
- release/*
- feature/*
- bug/*
jobs:
build:
@mizner
mizner / block-editor-by-date.php
Created October 14, 2019 10:26
Block Editor By Date
<?php
namespace view;
function enable_by_date( $can_edit, $post ) {
if ( empty( $post->ID ) ) {
return $can_edit;
}
@mizner
mizner / remote-images.php
Created September 15, 2019 21:03
MU Plugin: Remote Images
<?php
/**
* Plugin Name: Remote Images
*/
if(!in_array($_SERVER['SERVER_NAME'], ['EXAMPLELOCALDOMAIN.test', 'ANOTHEREXAMPLE.test'])) {
return;
}
@mizner
mizner / filter-gutenblock.php
Created February 6, 2019 08:39
Filter WordPress Gutenberg Block Output
<?php
add_filter('render_block', function ($block_content, $block) {
// Remove the block/timed-block from the rendered content.
if ('core/paragraph' === $block['blockName']) {
$block_content = "<div class='wp-block' data-blockType='{$block['blockName']}'>{$block_content}</div>";
}
return $block_content;
}, 10, 2);
@mizner
mizner / Property.php
Created January 3, 2019 19:48
custom-metadata example
<?php
namespace Pyxl\One\Models\FieldGroups;
use Pyxl\One\Models\PostTypes\Property as CPT;
class Property {
public static function init() {
$class = new self;
add_action( 'custom_metadata_manager_init_metadata', [ $class, 'register' ] );
Use these in the GV search field. You will likely need to refresh/select all after each as you can only do ten messages at a time.
* Mark all SMS/Text Messages as Read
label:sms is:unread
* Mark all voicemails as Read
label:voicemail is:unread
@mizner
mizner / ubuntu.md
Last active August 13, 2018 01:19
Digital Ocean - Ubuntu 16.04 (Simple Web Server)

Server setup for Ubuntu 16.04 on Digital Ocean

Chapter 1: Add User (w/ Security Steps)

Add User

adduser {{username}}

Make user a super user