Merge pull request #18 from lbryio/publishing-tag-feature

Support tagging feature when publishing
This commit is contained in:
Paul Kirby 2020-01-27 21:46:54 -06:00 committed by GitHub
commit 298bbf43c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,7 @@ class LBRY_Network_Publisher
{ {
/** /**
* Publish the post to the LBRY Network * Publish the post to the LBRY Network
* @param int $post_id The ID of the post we are publishing * @param WP_POST $post_id The ID of the post we are publishing
* @param string $channel The Claim ID of the channel we are posting to * @param string $channel The Claim ID of the channel we are posting to
*/ */
// NOTE: This is currently sitting at about 150ms, mostly the post parsing // NOTE: This is currently sitting at about 150ms, mostly the post parsing
@ -50,6 +50,16 @@ class LBRY_Network_Publisher
$args['thumbnail_url'] = $featured_image[0]; $args['thumbnail_url'] = $featured_image[0];
} }
// Setup Tags
$tags = get_the_terms( $post, 'post_tag' );
if ($tags) {
$tag_names = [];
foreach ($tags as $tag) {
$tag_names[] = $tag->name;
}
$args['tags'] = $tag_names;
}
// Build description using Yoast if installed and its used, excerpt/title otherwise // Build description using Yoast if installed and its used, excerpt/title otherwise
$description = false; $description = false;
if (class_exists('WPSEO_META')) { if (class_exists('WPSEO_META')) {