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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
'use strict'; | |
var oobManualAuthorization = require('./user-authorization-manual'); | |
var OAuth = require( 'oauth' ); | |
var oauth = new OAuth.OAuth( | |
// reqURL | |
'http://wpapi.loc/oauth1/request', | |
// accessURL | |
'http://wpapi.loc/oauth1/access', |
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
var WPAPI = require( 'wpapi' ); | |
var wp = new WPAPI({ | |
endpoint: endpointUrl, | |
oauth: { | |
clientId: clientId, | |
clientSecret: clientSecret, | |
callback: callbackUrl // optional: (defaults to oob) | |
} | |
}); |
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
class Returner { | |
private static $returned = array(); | |
private $value; | |
public function __construct( $value ) { | |
$this->value = $value; | |
} | |
public function result( $arg ) { | |
return $this->value; | |
} | |
public static function v( $value ) { |
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 | |
class jpen_Example_Widget extends WP_Widget { | |
// Set up the widget name and description. | |
public function __construct() { | |
$widget_options = array( 'classname' => 'example_widget', 'description' => 'This is an Example Widget' ); | |
parent::__construct( 'example_widget', 'Example Widget', $widget_options ); | |
} | |
// Create the widget output. | |
public function widget( $args, $instance ) { | |
$title = apply_filters( 'widget_title', $instance[ 'title' ] ); |
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 | |
function myplugin_enqueue_scripts() { | |
$plugin_url = plugin_dir_url( __FILE__ ); | |
wp_enqueue_style( 'cssname', $plugin_url . 'assets/css.css', array(), '1.0' ); | |
wp_enqueue_script( 'jsname', $plugin_url . 'assets/js.js', array( 'jquery' ), '1.0' ); | |
} |
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 | |
function myplugin_add_post_type() { | |
register_post_type( 'reviews', | |
array( | |
'labels' => array( | |
'name' => __( 'Reviews' ), | |
'singular_name' => __( 'Review' ) | |
), | |
'public' => 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 | |
if( ! class_exists( 'WP_List_Table' ) ) { | |
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); | |
} | |
class MyPlugin_List_Table extends WP_List_Table | |
{ | |
public function prepare_items() | |
{ | |
$columns = $this->get_columns(); |
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 | |
function myplugin_my_shortcode( $atts = array(), $content = '' ) { | |
echo "This is some shortcode output"; | |
} | |
add_shortcode('my-shortcode','myplugin_my_shortcode'); |
OlderNewer