To make things simple, we're going to make a semi-structured way to display a mailing address.
We're going to start with a file tree that looks like this:
address-block
├ blocks
| ├ address.jsx
<?php | |
/* | |
Plugin Name: EDD Prompt Login On Checkout | |
Plugin URI: http://brianhogg.com/ | |
Description: Prompt login if email exists | |
Author: Dave Kiss | |
Version: 1.0.0 | |
Author URI: http://brianhogg.com | |
License: GPL2 | |
*/ |
// License: GPLv2+ | |
var el = wp.element.createElement, | |
registerBlockType = wp.blocks.registerBlockType, | |
ServerSideRender = wp.components.ServerSideRender, | |
TextControl = wp.components.TextControl, | |
InspectorControls = wp.editor.InspectorControls; | |
/* | |
* Here's where we register the block in JavaScript. |
<?php | |
/** | |
* Returns true if a database table column exists. Otherwise returns false. | |
* | |
* @link http://stackoverflow.com/a/5943905/2489248 | |
* @global wpdb $wpdb | |
* | |
* @param string $table_name Name of table we will check for column existence. | |
* @param string $column_name Name of column we are checking for. |
/*-------------------------------------- | |
Woocommerce - Allow Guest Checkout on Certain products | |
----------------------------------------*/ | |
// Display Guest Checkout Field | |
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' ); | |
function woo_add_custom_general_fields() { | |
global $woocommerce, $post; | |
echo '<div class="options_group">'; |
/** | |
* This Google Sheets script keeps data in the specified column sorted any time | |
* the data changes. | |
* | |
* After much research, there wasn't an easy way to automatically keep a column | |
* sorted in Google Sheets, and creating a second sheet to act as a "view" to | |
* my primary one in order to achieve that was not an option. Instead, I | |
* created a script that watches for when a cell is edited and triggers | |
* an auto sort. | |
* |
Press minus + shift + s
and return
to chop/fold long lines!
<? | |
/** | |
* Repeatable Custom Fields in a Metabox | |
* Author: Helen Hou-Sandi | |
* | |
* From a bespoke system, so currently not modular - will fix soon | |
* Note that this particular metadata is saved as one multidimensional array (serialized) | |
*/ | |
function hhs_get_sample_options() { |