This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_meta('post', 'custom-field', [ | |
'object_subtype' => 'custom-post-type', | |
'show_in_rest' => true | |
]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Create Custom Yoast Sitemap | |
* Credit: Unknown | |
* Last Tested: Unknown | |
********* | |
* HOW TO USE | |
* Replace TYPE with your custom type | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This works great for when the parent and child have different origins. | |
//in the parent | |
/////////////////////////////////////////// | |
//<script> | |
function handleMessage(event) { | |
var accepted_origin = 'https://CHILDORIGIN.URL'; | |
if (event.origin == accepted_origin){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a promise: | |
myCoolPromise = new Promise (resolve, reject) -> | |
# do a thing | |
success = true | |
if success | |
resolve 'stuff worked' | |
else | |
reject Error 'it broke' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Traversing arrays and objects in CoffeeScript | |
# The array and object we use for testing | |
arr = [1, 2, 3, 4, 5] | |
obj = {a: 1, b: 2, c: 3, d: 4, e: 5} | |
# 'in' has a different meaning in CoffeeScript than in JavaScript | |
# CS: element in array -> JS: array.indexOf(element) >= 0 | |
console.log '5 in arr: ' + (5 in arr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# request.coffee | |
# | |
# Created by Wess Cope on 2012-01-30. | |
# | |
# Just a start. The basics in place and working | |
# to expand as elements are needed. | |
# | |
class Request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready -> | |
$.ajax '/items/get_list', | |
type: 'GET' | |
dataType: 'json' | |
beforeSend: -> | |
$('#loading').html "<img src='/assets/loading.gif' /> Now loading..." | |
error: (jqXHR, textStatus, errorThrown) -> | |
$('#items').html "Error: #{textStatus}" | |
success: (data, textStatus, jqXHR) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\define instructions() | |
With thanks to Tones (https://groups.google.com/g/tiddlywiki/c/avkbQnEd1UI/m/_sz6sEeFBwAJ) | |
Syntax | |
<<format-number n [t] [d] [p]>> | |
n is the number with or without decimal places (no default)t is the thousands separator (optional) - defaults to "," | |
(Can change default in format-number macro, set thousands-separator) | |
d is the decimal separator (optional) - defaults to "." | |
(Can change default in format-number macro, set decimal-separator) | |
p is the decimal places to use (optional) - defaults to "2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*\ | |
title: $:/plugins/OokTech/SubmitForm/action-submitform.js | |
type: application/javascript | |
module-type: widget | |
Action widget to send an XMLhttprequest with form data. | |
The widget takes two inputs, a url and the title of a data tiddler that contains the data to be sent. The indexes are the form element names and the value is the value for that element. | |
So if DataTiddler has this: | |
{ | |
"givenname": Bjorn, | |
"familyname": Mallardson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*\ | |
title: $:/plugins/OokTech/Login/login-widget.js | |
type: application/javascript | |
module-type: widget | |
A widget that creates a login interface for a restful server. | |
\*/ | |
(function(){ |
NewerOlder