| @@ 623-635 (lines=13) @@ | ||
| 620 | * @uses register_rest_field |
|
| 621 | * @link https://developer.wordpress.org/rest-api/extending-the-rest-api/modifying-responses/ |
|
| 622 | */ |
|
| 623 | function jetpack_post_likes_register_rest_field() { |
|
| 624 | register_rest_field( |
|
| 625 | 'post', 'jetpack_likes_enabled', |
|
| 626 | array( |
|
| 627 | 'get_callback' => 'jetpack_post_likes_get_value', |
|
| 628 | 'update_callback' => 'jetpack_post_likes_update_value', |
|
| 629 | 'schema' => array( |
|
| 630 | 'description' => __( 'Are Likes enabled?' ), |
|
| 631 | 'type' => 'boolean' |
|
| 632 | ), |
|
| 633 | ) |
|
| 634 | ); |
|
| 635 | } |
|
| 636 | ||
| 637 | // Add Likes post_meta to the REST API Post response. |
|
| 638 | add_action( 'rest_api_init', 'jetpack_post_likes_register_rest_field' ); |
|
| @@ 592-604 (lines=13) @@ | ||
| 589 | * @uses register_rest_field |
|
| 590 | * @link https://developer.wordpress.org/rest-api/extending-the-rest-api/modifying-responses/ |
|
| 591 | */ |
|
| 592 | function jetpack_post_sharing_register_rest_field() { |
|
| 593 | register_rest_field( |
|
| 594 | 'post', 'jetpack_sharing_enabled', |
|
| 595 | array( |
|
| 596 | 'get_callback' => 'jetpack_post_sharing_get_value', |
|
| 597 | 'update_callback' => 'jetpack_post_sharing_update_value', |
|
| 598 | 'schema' => array( |
|
| 599 | 'description' => __( 'Are sharing buttons enabled?' ), |
|
| 600 | 'type' => 'boolean' |
|
| 601 | ), |
|
| 602 | ) |
|
| 603 | ); |
|
| 604 | } |
|
| 605 | ||
| 606 | // Add Sharing post_meta to the REST API Post response. |
|
| 607 | add_action( 'rest_api_init', 'jetpack_post_sharing_register_rest_field' ); |
|