From 7000fad4d9b9ff0207b39683bce22f6ab0d8a28c Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Thu, 2 Aug 2018 23:27:43 -0500 Subject: [PATCH] Add a function for tags. --- posts/newsletter/1/info.yaml | 2 +- posts/newsletter/2/info.yaml | 2 +- posts/newsletter/3/info.yaml | 2 +- posts/newsletter/4/info.yaml | 2 +- posts/newsletter/5/info.yaml | 2 +- posts/newsletter/6/info.yaml | 2 +- posts/newsletter/7/info.yaml | 2 +- posts/newsletter/8/info.yaml | 2 +- posts/release/lubuntu-16.04.5/info.yaml | 2 +- update-post | 10 ++++++++++ 10 files changed, 19 insertions(+), 9 deletions(-) diff --git a/posts/newsletter/1/info.yaml b/posts/newsletter/1/info.yaml index ef5fe9d..6c8facf 100644 --- a/posts/newsletter/1/info.yaml +++ b/posts/newsletter/1/info.yaml @@ -1,4 +1,4 @@ --- title: This Week in Lubuntu Development POUND1 slug: this-week-in-lubuntu-development-1 -type: newsletter +type: ["newsletter"] diff --git a/posts/newsletter/2/info.yaml b/posts/newsletter/2/info.yaml index 750aae6..56afd19 100644 --- a/posts/newsletter/2/info.yaml +++ b/posts/newsletter/2/info.yaml @@ -1,4 +1,4 @@ --- title: This Week in Lubuntu Development POUND2 slug: this-week-in-lubuntu-development-2 -type: newsletter +type: ["newsletter"] diff --git a/posts/newsletter/3/info.yaml b/posts/newsletter/3/info.yaml index 7790843..4828b2b 100644 --- a/posts/newsletter/3/info.yaml +++ b/posts/newsletter/3/info.yaml @@ -1,4 +1,4 @@ --- title: This Week in Lubuntu Development POUND3 slug: this-week-in-lubuntu-development-3 -type: newsletter +type: ["newsletter"] diff --git a/posts/newsletter/4/info.yaml b/posts/newsletter/4/info.yaml index 5145959..91c0ef6 100644 --- a/posts/newsletter/4/info.yaml +++ b/posts/newsletter/4/info.yaml @@ -1,4 +1,4 @@ --- title: This Week in Lubuntu Development POUND4 slug: this-week-in-lubuntu-development-4 -type: newsletter +type: ["newsletter"] diff --git a/posts/newsletter/5/info.yaml b/posts/newsletter/5/info.yaml index 660da4a..0755f5f 100644 --- a/posts/newsletter/5/info.yaml +++ b/posts/newsletter/5/info.yaml @@ -1,4 +1,4 @@ --- title: This Week in Lubuntu Development POUND5 slug: this-week-in-lubuntu-development-5 -type: newsletter +type: ["newsletter"] diff --git a/posts/newsletter/6/info.yaml b/posts/newsletter/6/info.yaml index 8df22e5..52ca7ba 100644 --- a/posts/newsletter/6/info.yaml +++ b/posts/newsletter/6/info.yaml @@ -1,4 +1,4 @@ --- title: This Week in Lubuntu Development POUND6 slug: this-week-in-lubuntu-development-6 -type: newsletter +type: ["newsletter"] diff --git a/posts/newsletter/7/info.yaml b/posts/newsletter/7/info.yaml index f91cae8..bb4a9e2 100644 --- a/posts/newsletter/7/info.yaml +++ b/posts/newsletter/7/info.yaml @@ -1,4 +1,4 @@ --- title: This Week in Lubuntu Development POUND7 slug: this-week-in-lubuntu-development-7 -type: newsletter +type: ["newsletter"] diff --git a/posts/newsletter/8/info.yaml b/posts/newsletter/8/info.yaml index 2d70c8e..5888cb3 100644 --- a/posts/newsletter/8/info.yaml +++ b/posts/newsletter/8/info.yaml @@ -1,5 +1,5 @@ --- title: This Week in Lubuntu Development POUND8 slug: this-week-in-lubuntu-development-8 -type: newsletter +type: ["newsletter"] l10n: ["es"] diff --git a/posts/release/lubuntu-16.04.5/info.yaml b/posts/release/lubuntu-16.04.5/info.yaml index c078142..04a52b6 100644 --- a/posts/release/lubuntu-16.04.5/info.yaml +++ b/posts/release/lubuntu-16.04.5/info.yaml @@ -1,4 +1,4 @@ --- title: Lubuntu 16.04.5 has been released! slug: xenial-5-released -type: release +type: ["release", "final"] diff --git a/update-post b/update-post index a7d0463..d1cea4d 100755 --- a/update-post +++ b/update-post @@ -22,6 +22,7 @@ from os import path from markdown import markdown from wordpress_xmlrpc import Client from wordpress_xmlrpc.methods import posts +from wordpress_xmlrpc.methods import taxonomies def getdirectories(args): directories = [] @@ -70,6 +71,15 @@ def updatepost(infoyaml, md, post=None, title=None, slug=None): post.title = title post.content = md post.post_status = "publish" + + tags = [] + for category in wp.call(taxonomies.GetTerms('category')): + for posttype in infoyaml["type"]: + if category.name == posttype: + tags.append(category) + + post.terms = tags + wp.call(posts.EditPost(post.id, post)) def main():