This file contains 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
public static function name( $post ) { | |
// Use nonce for verification | |
wp_nonce_field( plugin_basename( __FILE__ ), 'scholar_name_nonce' ); | |
$prefix = get_post_meta( $post->ID, 'scholar_prefix', true ); | |
$first = get_post_meta( $post->ID, 'scholar_first_name', true ); | |
$middle = get_post_meta( $post->ID, 'scholar_middle_name', true ); | |
$last = get_post_meta( $post->ID, 'scholar_last_name', true ); | |
$gender = get_post_meta( $post->ID, 'scholar_gender', true ); | |
$suffix = get_post_meta( $post->ID, 'scholar_suffix', true ); | |
This file contains 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
<div id="popup"> | |
<div id="spinner"><?= $this->Html->image('ajax-loader.gif', ['alt' => 'Please wait...']); ?></div> | |
<div id="popup-content"> </div> | |
</div> |
This file contains 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
/* | |
* Generic function for opening a dialog box | |
* @var str url: the URL for the content that will be loaded into the dialog | |
* @var obj data: a data object to pass to the URL | |
* @var obj options: the Dialog "options" object | |
* @var func complete: a callable function to be performed when the content loads into the dialog | |
*/ | |
jQuery.fn.openDialog = function( url, data, options, complete ) { | |
var popup = $( "#popup" ); | |
var content = $( "#popup-content" ); |
This file contains 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
// CREDIT: http://stackoverflow.com/a/25497346/5418851 | |
// Make sure all change events on autocomplete fields happen before submit: | |
$(document).on( 'submit', '#facet-search', function( e, changeDone ) { | |
changeDone = changeDone || false; | |
if( !changeDone ) { | |
e.preventDefault(); | |
$( '.ui-autocomplete' ).trigger( 'change' ); | |
$( e.currentTarget ).trigger( 'submit', true ); | |
} else { | |
return true; |
This file contains 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
// In AppController.php: | |
public function initialize() { | |
// Default title | |
$title = sprintf( | |
'%s: %s', | |
ucfirst( $this->name ), | |
$this->request->params['action'] | |
); | |
$this->set( 'title', $title ); | |
parent::initialize(); |
This file contains 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
Array | |
( | |
[0] => Array | |
( | |
[0] => Array | |
( | |
[0] => 290144 | |
[1] => 01/31/17 | |
[2] => | |
[3] => |
This file contains 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
if( $this->request->query( 'fmt' ) == 'items' ) : | |
$invoices = collection( $invoices )->map( function( $invoice, $key ) use ( $columns ) { | |
// Iterated through line items, rather than invoices: | |
$lis = collection( $invoice->line_items )->map( function( $line_item, $k ) use ( $invoice, $columns ) { | |
$line = []; | |
foreach( $columns as $ckey=>$meta ) : | |
// For line item lists: | |
if( preg_match( '/line_item/i', $meta ) ) : | |
$meta = preg_replace( '/line_item\./i', '', $meta ); | |
$line[] = $line_item->{$meta}; |
This file contains 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
/** | |
* Converts single-key metadata into multiple keys. | |
* | |
* @when before_wp_load | |
*/ | |
$datagram_convert = function() { | |
$datagrams = WP_CLI::runcommand( | |
'post list --post_type=datagram --format=json', | |
[ |
This file contains 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
/* | |
* Apply Payments to Invoices | |
*/ | |
public function applyPayments() { | |
$this->loadModel('PaymentMethods'); | |
$invoices = $this->Invoices | |
->find( 'summary' ) | |
->where([ 'Invoices.id IN' => $this->request->data( 'invoices' ) ]); | |
// Add totals: |
This file contains 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
[wp-tabbitygroup title="This is the Title for the layout. Leave this blank to not use it"] | |
[wp-tabbity title="Tab One"]Contents of Tab One[/wp-tabbity] | |
[wp-tabbity title="Tab Two"]Contents of Tab Two[/wp-tabbity] | |
[wp-tabbity title="Tab Three"]Contents of Tab Three[/wp-tabbity] | |
[/wp-tabbitygroup] |