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
{ | |
"body" : $input.json('$'), | |
"headers": { | |
#foreach($header in $input.params().header.keySet()) | |
"$header": "$util.escapeJavaScript($input.params().header.get($header))" #if($foreach.hasNext),#end | |
#end | |
}, | |
"method": "$context.httpMethod", | |
"params": { |
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
const DOC = require('dynamodb-doc'); | |
const dynamo = DOC.DynamoDB(); | |
exports.handler = (event, context, callback) => { | |
// TODO implement | |
const params = { | |
TableName: "groups" | |
}; | |
dynamo.scan(params, (err, data) => { |
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
//We need to call wp_enqueue_media function in backend to load all media javascript API | |
(function() { | |
function showMediaFilePopup() { | |
//Add a custom media uploader object | |
var uploader = wp.media.frames.file_frame = wp.media({ | |
title: 'Choose Media', | |
frame: 'select', | |
button: { | |
text: 'Choose Media' | |
}, |
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
<?php | |
add_filter( 'manage_posts_columns', 'add_new_column_handler' ); | |
function add_new_column_handler( $columns ) { | |
$columns['your_custom_column_name'] = 'Column Title'; | |
return $columns; | |
} |
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
<?php | |
add_filter( 'manage_pages_columns', 'add_new_column_handler' ); | |
function add_new_column_handler( $columns ) { | |
$columns['your_custom_column_name'] = 'Column Title'; | |
return $columns; | |
} |
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
<?php | |
add_filter( 'manage_posts_columns', 'add_new_column_handler' ); | |
function add_new_column_handler( $columns ) { | |
$columns['your_custom_column_name'] = 'Column Title'; | |
return $columns; | |
} | |
add_action( 'manage_posts_custom_column', 'add_custom_column_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
<?php | |
add_filter( 'manage_pages_columns', 'add_new_column_handler' ); | |
function add_new_column_handler( $columns ) { | |
$columns['your_custom_column_name'] = 'Column Title'; | |
return $columns; | |
} | |
add_action( 'manage_pages_custom_column', 'add_custom_column_content' ); | |
/* Display custom column's content */ | |
function add_custom_column_content( $column, $post_id ) { | |
//We will check whether the column is our defined column above by name |
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
<?php | |
class My_Table { | |
protected $table_version; | |
protected $table_name; | |
public function __contruct() { | |
global $wpdb; | |
$this->db_version = get_option('my_table_version') === false ? '1.0' : get_option('my_table_version'); | |
$this->table_name = $wpdb->prefix . 'my_table'; | |
} |
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
<?php | |
class My_Table { | |
.... | |
private function init() { | |
global $wpdb; | |
if ($wpdb->get_var("SHOW TABLES LIKE '$this->table_name'") != $this->table_name) { | |
$charset_collate = $wpdb->get_charset_collate(); | |
$sql = "CREATE TABLE $this->table_name ( |