Skip to content

Instantly share code, notes, and snippets.

View pdclark's full-sized avatar

Paul Clark pdclark

View GitHub Profile
@pdclark
pdclark / block-pods.php
Last active May 16, 2022 23:28
Gutenberg block to wrap the `[pods]` shortcode.
<?php
/**
* Plugin Name: Pods — Block
* Description: Gutenberg block to wrap the `[pods]` shortcode.
* Author: Paul Clark
* Author URI: https://pdclark.com
* Plugin URI: https://pd.cm/pods-block
* Version: 28
*
* @package pd
@pdclark
pdclark / pd-blocks-example-oop.php
Last active July 15, 2023 23:26
Short example OOP PHP-rendered WordPress blocks with attributes.
<?php
/**
* Plugin Name: PD Blocks — Example OOP with attributes
* Description: Single-file OOP PHP-rendered WordPress blocks with 5 example blocks.
* Author: Paul David Clark
* Author URI: https://pd.cm
* Plugin URI: https://pd.cm/oop-blocks
* Version: 30
*
* @package pd
@pdclark
pdclark / block-hi-test.php
Last active November 21, 2023 16:40
The shortest possible example PHP-rendered WordPress block.
<?php
/**
* Plugin Name: Block — Hi Test
* Description: The shortest possible example PHP-rendered WordPress block.
* Author: Paul Clark
* Author URI: https://pdclark.com
*
* @package hi
*/
@pdclark
pdclark / ajax-enqueue-script-with-rest-api.php
Last active December 8, 2021 23:09
WordPress plugin demonstrating WP REST API. Sets a random background color from values calculated in PHP. Load random words from a remote API. Update every 3 seconds.
<?php
/**
* Plugin Name: AJAX Enqueue Script with REST API Example.
* Description: Set a random background color from values calculated in PHP. Load random words from a remote API. Update every 3 seconds.
*/
/**
* Data sent in JSON via wp_localize_script() for initialData and wp_ajax action for update_data.
*/
add_filter(
@pdclark
pdclark / ajax-enqueue-script-example.php
Last active December 8, 2021 22:55
WordPress plugin demonstrating WP AJAX API. Set a random background color from values calculated in PHP. Load random words from a remote API. Update every 3 seconds.
<?php
/**
* Plugin Name: AJAX Enqueue Script Example
* Description: Set a random background color from values calculated in PHP. Load random words from a remote API. Update every 3 seconds.
*
* @see https://gist.github.com/pdclark/5570bb145a1aa5f63f98b6bfd0783a9a
* For a version using WP REST API.
*/
/**

Keybase proof

I hereby claim:

  • I am pdclark on github.
  • I am pdclark (https://keybase.io/pdclark) on keybase.
  • I have a public key ASDUDwwuNpqmQCD-5gMd29Wf_iAEsohgabdyE4SFBjzXhwo

To claim this, I am signing this object:

@pdclark
pdclark / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pdclark
pdclark / delete-highrise-deals.js
Created April 11, 2014 00:56
Delete all deals in Highrise by 37Signals (basecamp.com)
/**
* This script should be pasted into a Browser debug console
* after clicking the Highrise links to show all deals.
*
* It may need to be run several times to deal with the massive amount
* of AJAX queries.
*/
// Inject jQuery
var s=document.createElement('script');
@pdclark
pdclark / wordpress-dot-org-responsive-fixes.css
Last active August 29, 2015 13:57
Basic fix for WordPress.org sidebar hiding content at bottom on small and medium window sizes.
/**
* Use with a user stylesheet plugin.
* For example: https://chrome.google.com/webstore/detail/minimalist-for-everything/bmihblnpomgpjkfddepdpdafhhepdbek?hl=en-US
*
* ## Minimalist Setup:
* Dashboard > Add Module > Edit
* Set @includes to: *wordpress.org*
* Add Option: Paste this file into "CSS"
* Save Changes
*/