public function register_routes($routes) { $routes = parent::register_routes($routes); // $routes = parent::register_revision_routes( $routes ); // $routes = parent::register_comment_routes( $routes ); // Add more custom routes here return $routes; }
/** * Prepare post data * * @param array $post The unprepared post data * @param array $fields The subset of post type fields to return * @return array The prepared post data */ protected function prepare_post($post, $context = 'view') { $_post = parent::prepare_post($post, $context); // Override entity meta keys with the correct links $_post['meta']['links']['self'] = json_url($this->base . '/' . get_page_uri($post['ID'])); if (!empty($post['post_parent'])) { $_post['meta']['links']['up'] = json_url($this->base . '/' . get_page_uri((int) $post['post_parent'])); } return apply_filters('json_prepare_page', $_post, $post, $context); }
public function register_routes($routes) { print "hi i'm here" . $base; exit; $routes = parent::register_routes($routes); // $routes = parent::register_revision_routes( $routes ); // $routes = parent::register_comment_routes( $routes ); // Add more custom routes here return $routes; }
protected function prepare_post($post, $context = 'view') { $post = parent::prepare_post($post, $context); if ($post['type'] === 'location') { $post['latitude'] = get_post_meta($post['ID'], 'latitude', true); $post['longitude'] = get_post_meta($post['ID'], 'longitude', true); $post['case_studies'] = $this->get_linked_content($post['ID'], 'case_study'); $post['galleries'] = $this->get_linked_content($post['ID'], 'gallery'); $post['has_events'] = count($post['case_studies']) + count($post['galleries']) > 0; } else { $post['event_date'] = get_post_meta($post['ID'], 'event_date', true); } return $post; }
protected function prepare_post($post, $context = 'view') { $post = parent::prepare_post($post, $context); // Add custom fields $post['given_name'] = get_post_meta($post['ID'], 'given_name', true); $post['surname'] = get_post_meta($post['ID'], 'surname', true); $post['job_title'] = get_post_meta($post['ID'], 'job_title', true); $post['location'] = get_post_meta($post['ID'], 'location', true); $post['email_address'] = get_post_meta($post['ID'], 'email_address', true); $post['facebook'] = get_post_meta($post['ID'], 'facebook', true); $post['twitter'] = get_post_meta($post['ID'], 'twitter', true); $post['instagram'] = get_post_meta($post['ID'], 'instagram', true); $post['linkedin'] = get_post_meta($post['ID'], 'linkedin', true); $post['pinterest'] = get_post_meta($post['ID'], 'pinterest', true); $post['google_plus'] = get_post_meta($post['ID'], 'google_plus', true); // Custom thumbnail sizes $headshot_id = get_post_thumbnail_id($post['ID']); if ($headshot_id) { list($src, $width, $height, $resized) = wp_get_attachment_image_src($headshot_id, 'team-member-headshot'); $post['headshot'] = array('ID' => (int) $headshot_id, 'src' => $src, 'width' => $width, 'height' => $height); } return $post; }
public function register_routes($routes) { $routes = parent::register_routes($routes); $routes = parent::register_revision_routes($routes); return $routes; }
public function register_routes($routes) { $routes = parent::register_routes($routes); $routes['/plots'] = array(array(array($this, 'create_plot'), WP_JSON_Server::CREATABLE | WP_JSON_Server::ACCEPT_JSON)); return $routes; }
public function __construct(WP_JSON_ResponseHandler $server) { parent::__construct($server); $this->plugins = get_option('active_plugins'); }
/** * Get the topics that a user created * * Kind of like bbp_get_user_topics_started() * * @see WP_JSON_Posts::get_posts() */ public function get_users_posts($user, $context = 'view') { return parent::get_posts(array('author' => $user), $context); }
public function get_publicacao($id, $context = 'view') { return parent::get_post($id, $context); }