Account for new post

This commit is contained in:
Jeremy Dormitzer 2018-10-19 06:18:31 -04:00
parent f069933b0e
commit 08db923066

View File

@ -41,6 +41,10 @@ Return an object of type Article
function post_to_object( $post ) {
setup_postdata( $post );
$permalink = get_permalink( $post );
$summary = null;
if ( $post->post_content ) {
$summary = get_the_excerpt( $post );
}
$matches = array();
if ( preg_match( '/(.+)__trashed\/$/', $permalink, $matches ) ) {
$permalink = $matches[1] . '/';
@ -54,7 +58,7 @@ function post_to_object( $post ) {
null, sprintf( '/pterotype/v1/actor/%s', PTEROTYPE_BLOG_ACTOR_SLUG )
),
'url' => $permalink,
'summary' => get_the_excerpt( $post ),
'summary' => $summary,
);
$existing = get_existing_object( $permalink );
if ( $existing ) {