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
add_filter( 'the_content', 'add_review_score_content' ); | |
function add_review_score_content( $content ) { | |
global $post; | |
if ( ! is_singular() || $post->post_type !== 'reviews' ) | |
{ | |
// It's not a single Review so just return standard content | |
return $content; |
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
{ | |
"id": 1800, | |
"date": "2017-01-31T00:00:00", | |
"post_title": "My Page Title", | |
"post_content": "Featured Images", | |
"content_buckets": { | |
"images": [ | |
{ | |
"id": "cb5df5c5-3128-4dc1-b5e4-19144f1dbbbb", | |
"attachment_id": 1848, |
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'); |
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_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 | |
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 | |
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
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
var WPAPI = require( 'wpapi' ); | |
var wp = new WPAPI({ | |
endpoint: endpointUrl, | |
oauth: { | |
clientId: clientId, | |
clientSecret: clientSecret, | |
callback: callbackUrl // optional: (defaults to oob) | |
} | |
}); |
NewerOlder