Skip to content

Instantly share code, notes, and snippets.

View jmichaelward's full-sized avatar

Jeremy Ward jmichaelward

View GitHub Profile
@jmichaelward
jmichaelward / CustomHookService.php
Created December 7, 2022 00:27
Class for wrapping native WordPress hooks in separate callbacks.
<?php
/**
* Thinking through a possible implementation for wrapping native WordPress hooks with my own.
*/
declare( strict_types=1 );
namespace JMichaelWard\PluginConcept;
/**
@jmichaelward
jmichaelward / example-template.php
Last active April 9, 2021 13:56
Render a Gravity Forms editor block on another page.
<?php
get_header();
/** @var WP_Post $page */
$page = get_post( 308 );
$blocks = parse_blocks( $page->post_content );
ob_start();
/* global wp, myPlugin */
const {
apiFetch
} = wp;
const postMyData = () => {
apiFetch.use( apiFetch.createNonceMiddleware( myPlugin.nonce ) );
apiFetch(
{
@jmichaelward
jmichaelward / BoardGameCollector.php
Created July 20, 2019 19:34
The main class file for the Board Game Collector plugin as of 2019-07-20.
<?php
namespace JMichaelWard\BoardGameCollector;
use Auryn\Injector;
use WebDevStudios\OopsWP\Structure\Plugin\Plugin;
use WebDevStudios\OopsWP\Structure\Service;
use JMichaelWard\BoardGameCollector\Content\ContentRegistrar;
use JMichaelWard\BoardGameCollector\Api\ApiService;
use JMichaelWard\BoardGameCollector\UI\Cli\CliService;
use JMichaelWard\BoardGameCollector\Cron\CronService;
@jmichaelward
jmichaelward / board-game-collector.php
Created July 20, 2019 18:30
Bootstrap file for Board Game Collector plugin.
<?php
/**
* Plugin Name: Board Game Collector
* Plugin URI: https://jmichaelward.com
* Description: Connects to the BoardGameGeek API to retrieve and adapt data for use by WordPress.
* Author: J. Michael Ward
* Author URI: https://jmichaelward.com
*
* @package JMichaelWard\BoardGameCollector
*/