Skip to content

Instantly share code, notes, and snippets.

View djcowan's full-sized avatar
Unite

djcowan djcowan

Unite
View GitHub Profile
@djcowan
djcowan / acknowledgement.html
Created January 15, 2025 03:30
wp-acknowledgement
<!-- wp:columns -->
<div class="wp-block-columns" id="acknowledgment"><!-- wp:column {"verticalAlignment":"top","width":"20%"} -->
<div class="wp-block-column is-vertically-aligned-top" style="flex-basis:20%"><!-- wp:group {"style":{"spacing":{"padding":{"top":"0.25em"}}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"left","verticalAlignment":"top"}} -->
<div class="wp-block-group" style="padding-top:0.25em"><!-- wp:image {"id":829,"width":"75px","sizeSlug":"full","linkDestination":"none"} -->
<figure class="wp-block-image size-full is-resized"><img src="/aboriginal-flag.png" alt="Australian Aboriginal Flag
The top half of the flag is black to symbolise Indigenous people. The red in the lower half stands for the earth and the colour of ochre, which has ceremonial significance. The circle of yellow in the centre of the flag represents the sun." class="wp-image-829" style="width:75px"/></figure>
<!-- /wp:image -->
<!-- wp:image {"id":828,"width":"75px","sizeSlug":"full","linkDestination":"none"
@djcowan
djcowan / custom-forms.php
Created December 9, 2024 04:42
Wordpress custom form css loader for non gutenberg forms
<?php
declare(strict_types=1);
namespace imageDirect;
/**
* Inline Block Styles
* @package imagedirect-phn-pathway
* @since 1.0.13
@djcowan
djcowan / .tsconfig
Last active August 27, 2024 00:20
Wordpress Block Typescript
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"allowJs": true,
"checkJs": true,
"allowSyntheticDefaultImports": true,
"jsx": "preserve",
"target": "esnext",
"module": "esnext",
@djcowan
djcowan / variations.tsx
Last active September 19, 2024 11:30
Wordpress BlockVariation Array<BlockVariation> Type
import { RiCellphoneLine, RiCheckboxLine, RiUserFollowLine, RiCheckLine, RiCalendarLine, RiPhoneLine, type RemixiconComponentType, } from '@remixicon/react';
import type { BlockVariation } from "@wordpress/blocks";
const variations: Array<BlockVariation> = [
{
isDefault: true,
scope: [ 'inserter', 'transform' ],
@djcowan
djcowan / wp-extend-gutenberg.js
Created July 6, 2024 12:29 — forked from jeremyphillips/wp-extend-gutenberg.js
Extend Wordpress Gutenberg blocks via React
const { __ } = wp.i18n;
const { addFilter } = wp.hooks;
const { createHigherOrderComponent } = wp.compose;
const { Fragment, cloneElement } = wp.element;
const { InspectorControls } = wp.editor;
const { PanelBody, ToggleControl } = wp.components;
const blockHasParent = ( clientId ) => clientId !== wp.data.select( 'core/editor' ).getBlockHierarchyRootClientId( clientId );
// Filter supports props
addFilter(
@djcowan
djcowan / laravel_valet_setup.md
Created April 25, 2024 06:41 — forked from bradtraversy/laravel_valet_setup.md
Laravel Valet install on mac

Laravel Valet Setup (Mac)

This will get you setup with Laravel & Valet on your Mac. Quentin Watt has a good video tutorial on getting setup here as well

Install Homebrew

Go to https://brew.sh/ and copy the command and run in your terminal

It will be something like this...

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/*
* @link <https://wordpress.org/support/topic/left-and-right-image-alignment-issues-with-fse-themes/>
* @author https://wordpress.org/support/users/jharries/
* @todo widewidth...
*/
@media only screen and (min-width : 768px) {
.is-layout-constrained figure.wp-block-image.alignleft {
margin-left: calc( ( 100% - var(--wp--style--global--content-size)) / 2 );
}
@djcowan
djcowan / example-wp-list-table.php
Created March 31, 2024 05:40 — forked from paulund/example-wp-list-table.php
An example code of using the WP_List_Table class. With Pagination.
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
@djcowan
djcowan / function.php
Created February 23, 2024 08:08 — forked from mattclements/function.php
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
<?php
# SHORTS
# DIRECTORY SEPARATOR
define( 'DS', DIRECTORY_SEPARATOR );
# PATH SEPARATOR
define( 'PS', PATH_SEPARATOR );
# Absolute path to the WordPress directory.
! defined( 'ABSPATH' )
AND define( 'ABSPATH', dirname( __FILE__ ).DS );