Skip to content

Instantly share code, notes, and snippets.

View acketon's full-sized avatar

Dakota Chichester acketon

  • Boston University - @bu-ist
  • Boston, MA
View GitHub Profile
@acketon
acketon / use-request-data-pagination.js
Created July 8, 2025 21:26
useRequestDataWithPagination
/**
* WordPress dependencies
*/
import { store as coreStore } from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';
import { useState, useEffect } from '@wordpress/element';
import apiFetch from '@wordpress/api-fetch';
import { addQueryArgs } from '@wordpress/url';
// Internal dependencies
@acketon
acketon / edit.js
Last active October 31, 2024 18:48 — forked from tousignant-christopher/_edit.js
useBlockProps API v.2
import { useBlockProps } from "@wordpress/block-editor";
function Edit( props ) {
const { isSelected } = props;
const blockProps = useBlockProps( {
style: {
color: '#222222',
backgroundColor: '#eeeeee',
padding: '15px'
@acketon
acketon / button.js
Created June 20, 2024 14:36
inspector-partial-example
import { InspectorControlsPartial as InspectorControls } from './editor-partials/inspector-controls';
...
/* pretend this is inside the Edit.js file */
return (
<InspectorControls
themeOptions={ themeOptions }
/**
* Inspector Controls Partial for Button Block
*
* Moves the InspectorControls component out of the edit
* function of the Button block to a separate partial to
* keep the block's edit function cleaner.
*/
import { __ } from '@wordpress/i18n';
<!doctype html>
<html style="margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.2;">
<head>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
<meta name="x-apple-disable-message-reformatting">
<title>BU Today 07-01-19</title>