I’m looking for a method to embed basing {custom} put up infomation, akin to put up title and few {custom} metas on different web site.
The simplest appears to be doing it in iFrame, however there are numerous “no’s”, you possibly can’t model it as a lot as you need and so forth. So after replace to 4.7 and avaiability of REST API I although it could be nice to make use of that, and retrievve wanted values with API name. However when I attempt to use https://instance.com/wp-json/wp/v2/posts/11
the place 11
is {custom} put up sort referred to as st_activity
, I am getting put up content material and all the knowledge however my {custom} meta is lacking.
I’ve registered {custom} put up sort with API help, following
including
'show_in_rest' => true,
'rest_base' => 'activity-api',
'rest_controller_class' => 'WP_REST_Posts_Controller',
and adjusted meta:
operate slug_register_rate_review() {
register_rest_field( 'st_activity',
'rate_review',
array(
'get_callback' => 'slug_get_st_activity',
'update_callback' => null,
'schema' => null,
)
);
}
operate slug_get_st_activity($put up, $field_name, $request) {
return get_post_meta($put up['id'], 'rate_review' );
}
Nicely, clearly I am doing one thing unsuitable however do not know what precisely.
And ddespite that, is it attainable and how you can get solely title, hyperlink, and {custom} meta with out all the opposite values? Thanks!