Skip to content

Commit

Permalink
Update for Works Post Type
Browse files Browse the repository at this point in the history
  • Loading branch information
conradfuhrman committed Feb 4, 2021
1 parent e49e1c1 commit a56632e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "GPL-3.0",
"require": {
"php": ">=7.0",
"composer/installers": "~1.0"
"composer/installers": "v1.8.0"
},
"extra": {
"installer-name": "seo-to-api"
Expand Down
18 changes: 9 additions & 9 deletions seo-to-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: SEO to API
* Plugin URI: https://github.com/conradfuhrman/SEO-To-API
* Description: Expose the meta of the SEO Framework to the WP API
* Version: 1.1
* Version: 1.3
* Author: Conrad Fuhrman
* Author URI: https://github.com/conradfuhrman/
*
Expand All @@ -22,7 +22,7 @@
if (isset($_REQUEST['slug'])) {
$args = [
'name' => $_REQUEST['slug'],
'post_type' => ['post', 'page', 'work'],
'post_type' => ['post', 'page', 'works'],
'post_status' => 'publish',
'numberposts' => 1
];
Expand All @@ -31,31 +31,31 @@



register_rest_field(['post', 'page', 'work'], 'meta_title', [
register_rest_field(['post', 'page', 'works'], 'meta_title', [
'get_callback' => function () use ($post) { return html_entity_decode(the_seo_framework()->get_title($post->ID)); }
]);

register_rest_field(['post', 'page', 'work'], 'meta_description', [
register_rest_field(['post', 'page', 'works'], 'meta_description', [
'get_callback' => function () use ($post) { return html_entity_decode(the_seo_framework()->get_description($post->ID)); }
]);

register_rest_field(['post', 'page', 'work'], 'meta_social_image_url', [
register_rest_field(['post', 'page', 'works'], 'meta_social_image_url', [
'get_callback' => function () use ($post) { return html_entity_decode(the_seo_framework()->get_social_image( ['post_id' => $post->ID,])); }
]);

register_rest_field(['post', 'page', 'work'], 'meta_open_graph_title', [
register_rest_field(['post', 'page', 'works'], 'meta_open_graph_title', [
'get_callback' => function () use ($post) { return html_entity_decode(the_seo_framework()->get_open_graph_title($post->ID)); }
]);

register_rest_field(['post', 'page', 'work'], 'meta_open_graph_description', [
register_rest_field(['post', 'page', 'works'], 'meta_open_graph_description', [
'get_callback' => function () use ($post) { return html_entity_decode(the_seo_framework()->get_open_graph_description($post->ID)); }
]);

register_rest_field(['post', 'page', 'work'], 'meta_twitter_title', [
register_rest_field(['post', 'page', 'works'], 'meta_twitter_title', [
'get_callback' => function () use ($post) { return html_entity_decode(the_seo_framework()->get_twitter_title($post->ID)); }
]);

register_rest_field(['post', 'page', 'work'], 'meta_twitter_description', [
register_rest_field(['post', 'page', 'works'], 'meta_twitter_description', [
'get_callback' => function () use ($post) { return html_entity_decode(the_seo_framework()->get_twitter_description($post->ID)); }
]);
}
Expand Down

0 comments on commit a56632e

Please sign in to comment.